MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / fetch_data_from_db

Function fetch_data_from_db

pyxrf/model/load_data_from_db.py:185–312  ·  view source on GitHub ↗

Read data from databroker. This is the place where new beamlines can be easily added to pyxrf GUI. Save the data from databroker to hdf file if needed. .. note:: Requires the databroker package from NSLS2 Parameters ---------- runid : int id number for give

(
    run_id_uid,
    fpath=None,
    create_each_det=False,
    fname_add_version=False,
    completed_scans_only=False,
    successful_scans_only=False,
    file_overwrite_existing=False,
    output_to_file=False,
    save_scaler=True,
    num_end_lines_excluded=None,
    skip_scan_types=None,
    catalog_name=None,
)

Source from the content-addressed store, hash-verified

183
184
185def fetch_data_from_db(
186 run_id_uid,
187 fpath=None,
188 create_each_det=False,
189 fname_add_version=False,
190 completed_scans_only=False,
191 successful_scans_only=False,
192 file_overwrite_existing=False,
193 output_to_file=False,
194 save_scaler=True,
195 num_end_lines_excluded=None,
196 skip_scan_types=None,
197 catalog_name=None,
198):
199 """
200 Read data from databroker.
201 This is the place where new beamlines can be easily added
202 to pyxrf GUI.
203 Save the data from databroker to hdf file if needed.
204
205 .. note:: Requires the databroker package from NSLS2
206
207 Parameters
208 ----------
209 runid : int
210 id number for given run
211 fpath: str, optional
212 path to save hdf file
213 create_each_det: bool, optional
214 Do not create data for each detector is data size is too large,
215 if set as false. This will slow down the speed of creating hdf file
216 with large data size. srx beamline only.
217 fname_add_version : bool
218 True: if file already exists, then file version is added to the file name
219 so that it becomes unique in the current directory. The version is
220 added to <fname>.h5 in the form <fname>_(1).h5, <fname>_(2).h5, etc.
221 False: then conversion fails.
222 completed_scans_only : bool
223 True: process only completed scans (for which ``stop`` document exists in
224 the database). Failed scan for which ``stop`` document exists are considered
225 completed even if not the whole image was scanned. If incomplete scan is
226 encountered, an exception is thrown.
227 False: the feature is disabled, incomplete scan will be processed.
228 file_overwrite_existing : bool, keyword parameter
229 This option should be used if the existing file should be deleted and replaced
230 with the new file with the same name. This option should be used with caution,
231 since the existing file may contain processed data, which will be permanently deleted.
232 True: overwrite existing files if needed. Note, that if ``fname_add_version`` is ``True``,
233 then new versions of the existing file will always be created.
234 False: do not overwrite existing files. If the file already exists, then the exception
235 will be raised (loading the single scan) or the scan will be skipped (loading the range
236 of scans).
237 output_to_file : bool, optional
238 save data to hdf5 file if True
239 save_scaler : bool, optional
240 choose to save scaler data or not for srx beamline, test purpose only.
241 num_end_lines_excluded : int, optional
242 remove the last few bad lines

Callers 2

render_data_to_guiFunction · 0.90
make_hdfFunction · 0.85

Calls 6

get_catalogFunction · 0.85
map_data2D_hxnFunction · 0.85
map_data2D_srxFunction · 0.85
map_data2D_xfmFunction · 0.85
map_data2D_tesFunction · 0.85
free_memory_from_handlerFunction · 0.85

Tested by

no test coverage detected