def test_filter_fields(mds_all): mds = mds_all temperature_ramp.run(mds) db = Broker(mds, fs=None) hdr = db[-1] unwanted_fields = ['point_det'] out = nexus.filter_fields(hdr, unwanted_fields) #original list is ('point_det', 'boolean_det', 'ccd_det_info', 'Tsam'), # only ('boolean_det', 'ccd_det_info', 'Tsam') left after filtering out assert len(out)==3
def test_hdf5_export_single(): """ Test the hdf5 export with a single header and verify the output is correct """ temperature_ramp.run() hdr = db[-1] fname = tempfile.NamedTemporaryFile() hdf5.export(hdr, fname.name) shallow_header_verify(fname.name, hdr)
def test_filter_fields(mds_all): mds = mds_all temperature_ramp.run(mds) db = Broker(mds, fs=None) hdr = db[-1] unwanted_fields = ['point_det'] out = hdf5.filter_fields(hdr, unwanted_fields) #original list is ('point_det', 'boolean_det', 'ccd_det_info', 'Tsam'), # only ('boolean_det', 'ccd_det_info', 'Tsam') left after filtering out assert len(out)==3
def test_hdf5_export_with_fields_single(mds_all): """ Test the hdf5 export with a single header and verify the output is correct; fields kwd is used. """ mds = mds_all temperature_ramp.run(mds) db = Broker(mds, fs=None) hdr = db[-1] fname = tempfile.NamedTemporaryFile() hdf5.export(hdr, fname.name, mds, fields=['point_dev']) shallow_header_verify(fname.name, hdr, mds, fields=['point_dev'])
def test_hdf5_export_single_stream_name(mds_all): """ Test the hdf5 export with a single header and verify the output is correct. No uid is used. """ mds = mds_all temperature_ramp.run(mds) db = Broker(mds, fs=None) hdr = db[-1] fname = tempfile.NamedTemporaryFile() hdf5.export(hdr, fname.name, mds, stream_name='primary') shallow_header_verify(fname.name, hdr, mds, stream_name='primary')
def test_hdf5_export_list(): """ Test the hdf5 export with a list of headers and verify the output is correct """ temperature_ramp.run() temperature_ramp.run() hdrs = db[-2:] fname = tempfile.NamedTemporaryFile() # test exporting a list of headers hdf5.export(hdrs, fname.name) for hdr in hdrs: shallow_header_verify(fname.name, hdr)
def test_nexus_export_single_no_uid(mds_all): """ Test the NeXus HDF5 export with a single header and verify the output is correct. No uid is used. """ mds = mds_all temperature_ramp.run(mds) db = Broker(mds, fs=None) hdr = db[-1] fname = tempfile.NamedTemporaryFile() nexus.export(hdr, fname.name, mds, use_uid=False) shallow_header_verify(fname.name, hdr, mds, use_uid=False) validate_basic_NeXus_structure(fname.name)
def setup(): mds_setup() global blc_uid, run_start_uid, document_insertion_time document_insertion_time = ttime.time() temperature_ramp.run() blc_uid = mdsc.insert_beamline_config({}, time=document_insertion_time) run_start_uid = mdsc.insert_run_start(scan_id=3022013, beamline_id='testbed', beamline_config=blc_uid, owner='tester', group='awesome-devs', project='Nikea', time=document_insertion_time)
def filled_mds(mds_all_mod): mdsc = mds_all_mod temperature_ramp.run(mdsc) run_start_uid = mdsc.insert_run_start(scan_id=3022013, beamline_id='testbed', owner='tester', group='awesome-devs', project='Nikea', time=time.time(), uid=str(uuid.uuid4())) rs = mdsc.run_start_given_uid(run_start_uid) return mdsc, run_start_uid, rs
def setup(): mds_setup() global run_start_uid, document_insertion_time document_insertion_time = ttime.time() temperature_ramp.run() run_start_uid = mdsc.insert_run_start(scan_id=3022013, beamline_id='testbed', owner='tester', group='awesome-devs', project='Nikea', time=document_insertion_time, uid=str(uuid.uuid4()))
def setup_module(module): mds_setup() global run_start_uid, document_insertion_time document_insertion_time = ttime.time() temperature_ramp.run() run_start_uid = mdsc.insert_run_start(scan_id=3022013, beamline_id='testbed', owner='tester', group='awesome-devs', project='Nikea', time=document_insertion_time, uid=str(uuid.uuid4()))
def test_hdf5_export_list(mds_all): """ Test the hdf5 export with a list of headers and verify the output is correct """ mds = mds_all temperature_ramp.run(mds) temperature_ramp.run(mds) db = Broker(mds, fs=None) hdrs = db[-2:] fname = tempfile.NamedTemporaryFile() # test exporting a list of headers hdf5.export(hdrs, fname.name, mds) for hdr in hdrs: shallow_header_verify(fname.name, hdr, mds)
def test_nexus_export_list(mds_all): """ Test the NeXus HDF5 export with a list of headers and verify the output is correct """ mds = mds_all temperature_ramp.run(mds) temperature_ramp.run(mds) db = Broker(mds, fs=None) hdrs = db[-2:] fname = tempfile.NamedTemporaryFile() # test exporting a list of headers nexus.export(hdrs, fname.name, mds) for hdr in hdrs: shallow_header_verify(fname.name, hdr, mds) validate_basic_NeXus_structure(fname.name)
def test_temperature_ramp(mds_all): temperature_ramp.run(mds_all)
def test_temperature_ramp(): temperature_ramp.run()
def _failing_sleepy_ramp_helper(delay_time): # any non-zero values should work temperature_ramp.run(sleep=delay_time)