io#

Classes:

Scan(number, **kwargs)

Representation of a scan which holds the relevant data and meta information.

Source(file_name[, file_path])

Class of default source implementation.

Spec(file_name, file_path, **kwargs)

Source implementation for SPEC files.

SardanaNeXus(file_name, file_path, **kwargs)

Source implementation for Sardana NeXus files.

PalH5(name, file_name, file_path, **kwargs)

Source implementation for PalH5 folder/files.

class pyEvalData.io.Scan(number, **kwargs)[source]#

Bases: object

Representation of a scan which holds the relevant data and meta information.

Parameters

number (uint) – number of the scan.

Keyword Arguments
  • cmd (str) – scan command.

  • user (str) – scan user.

  • date (str) – scan date.

  • time (str) – scan time.

  • int_time (float) – integration time.

  • init_mopo (dict(float)) – initial motor position.

  • header (str) – full scan header.

Attributes
  • log (logging.logger) – logger instance from logging.

  • number (uint) – number of the scan.

  • meta (dict) – meta data dictionary.

  • data (ndarray[float]) – data recarray.

Methods:

index_data()

Check the dimensions of the data recarray elements and remember the names for scaler, 1d, and 2d data columns.

get_scalar_data()

Returns only scalar data from the data recarray.

get_oned_data()

Returns only 1d data from the data recarray.

get_twod_data()

Returns only 2d data from the data recarray.

clear_data()

Clears the data to save memory.

index_data()[source]#

Check the dimensions of the data recarray elements and remember the names for scaler, 1d, and 2d data columns.

get_scalar_data()[source]#

Returns only scalar data from the data recarray.

Returns

data (ndarray[float]) – scalar data.

get_oned_data()[source]#

Returns only 1d data from the data recarray.

Returns

data (ndarray[float]) – 1d data.

get_twod_data()[source]#

Returns only 2d data from the data recarray.

Returns

data (ndarray[float]) – 2d data.

clear_data()[source]#

Clears the data to save memory.

class pyEvalData.io.Source(file_name, file_path='./', **kwargs)[source]#

Bases: object

Class of default source implementation.

Parameters
  • file_name (str) – file name including extension, can include regex pattern.

  • file_path (str, optional) – file path - defaults to ./.

Keyword Arguments
  • start_scan_number (uint) – start of scan numbers to parse.

  • stop_scan_number (uint) – stop of scan numbers to parse. This number is included.

  • nexus_file_name (str) – name for generated nexus file.

  • nexus_file_name_postfix (str) – postfix for nexus file name.

  • nexus_file_path (str) – path for generated nexus file.

  • read_all_data (bool) – read all data on parsing. If false, data will be read only on demand.

  • read_and_forget (bool) – clear data after read to save memory.

  • update_before_read (bool) – always update from source before reading scan data.

  • use_nexus (bool) – use nexus file to join/compress raw data.

  • force_overwrite (bool) – forced re-read of raw source and re-generated of nexus file.

Attributes
  • log (logging.logger) – logger instance from logging.

  • name (str) – name of the source

  • scan_dict (dict(scan)) – dict of scan objects with key being the scan number.

  • start_scan_number (uint) – start of scan numbers to parse.

  • stop_scan_number (uint) – stop of scan numbers to parse. This number is included.

  • file_name (str) – file name including extension, can include regex pattern.

  • file_path (str, optional) – file path - defaults to ./.

  • nexus_file_name (str) – name for generated nexus file.

  • nexus_file_name_postfix (str) – postfix for nexus file name.

  • nexus_file_path (str) – path for generated nexus file.

  • nexus_file_exists (bool) – if nexus file exists.

  • read_all_data (bool) – read all data on parsing.

  • read_and_forget (bool) – clear data after read to save memory.

  • update_before_read (bool) – always update from source before reading scan data.

  • use_nexus (bool) – use nexus file to join/compress raw data.

  • force_overwrite (bool) – forced re-read of raw source and re-generated of nexus file.

Methods:

update([scan_number_list])

update the scan_dict either from the raw source file/folder or from the nexus file.

parse_raw()

Parse the raw source file/folder and populate the scan_dict.

parse_nexus()

Parse the nexus file and populate the scan_dict.

check_nexus_file_exists()

Check if the nexus file is present and set self.nexus_file_exists.

get_last_scan_number()

Return the number of the last scan in the scan_dict.

get_all_scan_numbers()

Return the all scan number from the scan_dict.

get_scan(scan_number[, read_data, ...])

Returns a scan object from the scan dict determined by the scan_number.

get_scan_list(scan_number_list[, read_data])

Returns a list of scan object from the scan_dict determined by the list of scan_number.

get_scan_data(scan_number)

Returns data and meta information from a scan object from the scan_dict determined by the scan_number.

get_scan_list_data(scan_number_list)

Returns data and meta information for a list of scan objects from the scan_dict determined by the scan_numbers.

read_scan_data(scan)

Reads the data for a given scan object.

read_raw_scan_data(scan)

Reads the data for a given scan object from raw source.

read_nexus_scan_data(scan)

Reads the data for a given scan object from the nexus file.

clear_scan_data(scan)

Clear the data for a given scan object.

read_all_scan_data()

Reads the data for all scan objects in the scan_dict from source.

clear_all_scan_data()

Clears the data for all scan objects in the scan_dict.

save_scan_to_nexus(scan[, nxs_file])

Saves a scan to the nexus file.

save_all_scans_to_nexus()

Saves all scan objects in the scan_dict to the nexus file.

get_nexus_file([mode])

Return the file handle to the NeXus file in a given mode`.

update(scan_number_list=[])[source]#

update the scan_dict either from the raw source file/folder or from the nexus file. The optional scan_number_list runs the update only if required for the included scan.

Attributes

scan_number_list (list[int]) – explicit list of scans

parse_raw()[source]#

Parse the raw source file/folder and populate the scan_dict.

parse_nexus()[source]#

Parse the nexus file and populate the scan_dict.

check_nexus_file_exists()[source]#

Check if the nexus file is present and set self.nexus_file_exists.

get_last_scan_number()[source]#

Return the number of the last scan in the scan_dict. If the scan_dict is empty return 0.

get_all_scan_numbers()[source]#

Return the all scan number from the scan_dict.

get_scan(scan_number, read_data=True, dismiss_update=False)[source]#

Returns a scan object from the scan dict determined by the scan_number.

Parameters
  • scan_number (uint) – number of the scan.

  • read_data (bool, optional) – read data from source. Defaults to False.

  • dismiss_update (bool, optional) – Dismiss update even if set as object attribute. Defaults to False.

Returns

scan (Scan) – scan object.

get_scan_list(scan_number_list, read_data=True)[source]#

Returns a list of scan object from the scan_dict determined by the list of scan_number.

Parameters
  • scan_number_list (list(uint)) – list of numbers of the scan.

  • read_data (bool, optional) – read data from source. Defaults to False.

Returns

scans (list(Scan)) – list of scan object.

get_scan_data(scan_number)[source]#

Returns data and meta information from a scan object from the scan_dict determined by the scan_number.

Parameters

scan_number (uint) – number of the scan.

Returns

data (numpy.recarray[float]) – scan data. meta (dict()): scan meta information.

get_scan_list_data(scan_number_list)[source]#

Returns data and meta information for a list of scan objects from the scan_dict determined by the scan_numbers.

Parameters

scan_number_list (list(uint)) – list of numbers of the scan.

Returns

data (list(numpy.recarray[float])) – list of scan data. meta (list(dict())): list scan meta information.

read_scan_data(scan)[source]#

Reads the data for a given scan object.

Parameters

scan (Scan) – scan object.

read_raw_scan_data(scan)[source]#

Reads the data for a given scan object from raw source.

Parameters

scan (Scan) – scan object.

read_nexus_scan_data(scan)[source]#

Reads the data for a given scan object from the nexus file.

Parameters

scan (Scan) – scan object.

clear_scan_data(scan)[source]#

Clear the data for a given scan object.

Parameters

scan (Scan) – scan object.

read_all_scan_data()[source]#

Reads the data for all scan objects in the scan_dict from source.

clear_all_scan_data()[source]#

Clears the data for all scan objects in the scan_dict.

save_scan_to_nexus(scan, nxs_file='')[source]#

Saves a scan to the nexus file.

save_all_scans_to_nexus()[source]#

Saves all scan objects in the scan_dict to the nexus file.

get_nexus_file(mode='rw')[source]#

Return the file handle to the NeXus file in a given mode`.

Parameters

mode (str, optional) – file mode. defaults to ‘rw’.

Returns

nxs_file (NXFile) – file handle to NeXus file.

class pyEvalData.io.Spec(file_name, file_path, **kwargs)[source]#

Bases: pyEvalData.io.source.Source

Source implementation for SPEC files.

Parameters
  • file_name (str) – file name including extension, can include regex pattern.

  • file_path (str, optional) – file path - defaults to ./.

Keyword Arguments
  • start_scan_number (uint) – start of scan numbers to parse.

  • stop_scan_number (uint) – stop of scan numbers to parse. This number is included.

  • nexus_file_name (str) – name for generated nexus file.

  • nexus_file_name_postfix (str) – postfix for nexus file name.

  • nexus_file_path (str) – path for generated nexus file.

  • read_all_data (bool) – read all data on parsing. If false, data will be read only on demand.

  • read_and_forget (bool) – clear data after read to save memory.

  • update_before_read (bool) – always update from source before reading scan data.

  • use_nexus (bool) – use nexus file to join/compress raw data.

  • force_overwrite (bool) – forced re-read of raw source and re-generated of nexus file.

Attributes
  • log (logging.logger) – logger instance from logging.

  • name (str) – name of the source

  • scan_dict (dict(scan)) – dict of scan objects with key being the scan number.

  • start_scan_number (uint) – start of scan numbers to parse.

  • stop_scan_number (uint) – stop of scan numbers to parse. This number is included.

  • file_name (str) – file name including extension, can include regex pattern.

  • file_path (str, optional) – file path - defaults to ./.

  • nexus_file_name (str) – name for generated nexus file.

  • nexus_file_name_postfix (str) – postfix for nexus file name.

  • nexus_file_path (str) – path for generated nexus file.

  • nexus_file_exists (bool) – if nexus file exists.

  • read_all_data (bool) – read all data on parsing.

  • read_and_forget (bool) – clear data after read to save memory.

  • update_before_read (bool) – always update from source before reading scan data.

  • use_nexus (bool) – use nexus file to join/compress raw data.

  • force_overwrite (bool) – forced re-read of raw source and re-generated of nexus file.

Methods:

parse_raw()

Parse the raw source file/folder and populate the scan_dict.

read_raw_scan_data(scan)

Reads the data for a given scan object from raw source.

check_nexus_file_exists()

Check if the nexus file is present and set self.nexus_file_exists.

clear_all_scan_data()

Clears the data for all scan objects in the scan_dict.

clear_scan_data(scan)

Clear the data for a given scan object.

get_all_scan_numbers()

Return the all scan number from the scan_dict.

get_last_scan_number()

Return the number of the last scan in the scan_dict.

get_nexus_file([mode])

Return the file handle to the NeXus file in a given mode`.

get_scan(scan_number[, read_data, ...])

Returns a scan object from the scan dict determined by the scan_number.

get_scan_data(scan_number)

Returns data and meta information from a scan object from the scan_dict determined by the scan_number.

get_scan_list(scan_number_list[, read_data])

Returns a list of scan object from the scan_dict determined by the list of scan_number.

get_scan_list_data(scan_number_list)

Returns data and meta information for a list of scan objects from the scan_dict determined by the scan_numbers.

parse_nexus()

Parse the nexus file and populate the scan_dict.

read_all_scan_data()

Reads the data for all scan objects in the scan_dict from source.

read_nexus_scan_data(scan)

Reads the data for a given scan object from the nexus file.

read_scan_data(scan)

Reads the data for a given scan object.

save_all_scans_to_nexus()

Saves all scan objects in the scan_dict to the nexus file.

save_scan_to_nexus(scan[, nxs_file])

Saves a scan to the nexus file.

update([scan_number_list])

update the scan_dict either from the raw source file/folder or from the nexus file.

parse_raw()[source]#

Parse the raw source file/folder and populate the scan_dict.

read_raw_scan_data(scan)[source]#

Reads the data for a given scan object from raw source.

Parameters

scan (Scan) – scan object.

check_nexus_file_exists()#

Check if the nexus file is present and set self.nexus_file_exists.

clear_all_scan_data()#

Clears the data for all scan objects in the scan_dict.

clear_scan_data(scan)#

Clear the data for a given scan object.

Parameters

scan (Scan) – scan object.

get_all_scan_numbers()#

Return the all scan number from the scan_dict.

get_last_scan_number()#

Return the number of the last scan in the scan_dict. If the scan_dict is empty return 0.

get_nexus_file(mode='rw')#

Return the file handle to the NeXus file in a given mode`.

Parameters

mode (str, optional) – file mode. defaults to ‘rw’.

Returns

nxs_file (NXFile) – file handle to NeXus file.

get_scan(scan_number, read_data=True, dismiss_update=False)#

Returns a scan object from the scan dict determined by the scan_number.

Parameters
  • scan_number (uint) – number of the scan.

  • read_data (bool, optional) – read data from source. Defaults to False.

  • dismiss_update (bool, optional) – Dismiss update even if set as object attribute. Defaults to False.

Returns

scan (Scan) – scan object.

get_scan_data(scan_number)#

Returns data and meta information from a scan object from the scan_dict determined by the scan_number.

Parameters

scan_number (uint) – number of the scan.

Returns

data (numpy.recarray[float]) – scan data. meta (dict()): scan meta information.

get_scan_list(scan_number_list, read_data=True)#

Returns a list of scan object from the scan_dict determined by the list of scan_number.

Parameters
  • scan_number_list (list(uint)) – list of numbers of the scan.

  • read_data (bool, optional) – read data from source. Defaults to False.

Returns

scans (list(Scan)) – list of scan object.

get_scan_list_data(scan_number_list)#

Returns data and meta information for a list of scan objects from the scan_dict determined by the scan_numbers.

Parameters

scan_number_list (list(uint)) – list of numbers of the scan.

Returns

data (list(numpy.recarray[float])) – list of scan data. meta (list(dict())): list scan meta information.

parse_nexus()#

Parse the nexus file and populate the scan_dict.

read_all_scan_data()#

Reads the data for all scan objects in the scan_dict from source.

read_nexus_scan_data(scan)#

Reads the data for a given scan object from the nexus file.

Parameters

scan (Scan) – scan object.

read_scan_data(scan)#

Reads the data for a given scan object.

Parameters

scan (Scan) – scan object.

save_all_scans_to_nexus()#

Saves all scan objects in the scan_dict to the nexus file.

save_scan_to_nexus(scan, nxs_file='')#

Saves a scan to the nexus file.

update(scan_number_list=[])#

update the scan_dict either from the raw source file/folder or from the nexus file. The optional scan_number_list runs the update only if required for the included scan.

Attributes

scan_number_list (list[int]) – explicit list of scans

class pyEvalData.io.SardanaNeXus(file_name, file_path, **kwargs)[source]#

Bases: pyEvalData.io.source.Source

Source implementation for Sardana NeXus files.

Parameters
  • file_name (str) – file name including extension, can include regex pattern.

  • file_path (str, optional) – file path - defaults to ./.

Keyword Arguments
  • start_scan_number (uint) – start of scan numbers to parse.

  • stop_scan_number (uint) – stop of scan numbers to parse. This number is included.

  • nexus_file_name (str) – name for generated nexus file.

  • nexus_file_name_postfix (str) – postfix for nexus file name.

  • nexus_file_path (str) – path for generated nexus file.

  • read_all_data (bool) – read all data on parsing. If false, data will be read only on demand.

  • read_and_forget (bool) – clear data after read to save memory.

  • update_before_read (bool) – always update from source before reading scan data.

  • use_nexus (bool) – use nexus file to join/compress raw data.

  • force_overwrite (bool) – forced re-read of raw source and re-generated of nexus file.

Attributes
  • log (logging.logger) – logger instance from logging.

  • name (str) – name of the source

  • scan_dict (dict(scan)) – dict of scan objects with key being the scan number.

  • start_scan_number (uint) – start of scan numbers to parse.

  • stop_scan_number (uint) – stop of scan numbers to parse. This number is included.

  • file_name (str) – file name including extension, can include regex pattern.

  • file_path (str, optional) – file path - defaults to ./.

  • nexus_file_name (str) – name for generated nexus file.

  • nexus_file_name_postfix (str) – postfix for nexus file name.

  • nexus_file_path (str) – path for generated nexus file.

  • nexus_file_exists (bool) – if nexus file exists.

  • read_all_data (bool) – read all data on parsing.

  • read_and_forget (bool) – clear data after read to save memory.

  • update_before_read (bool) – always update from source before reading scan data.

  • use_nexus (bool) – use nexus file to join/compress raw data.

  • force_overwrite (bool) – forced re-read of raw source and re-generated of nexus file.

Methods:

parse_raw()

Parse the Sardana NeXus file and populate the scan_dict.

read_raw_scan_data(scan)

Reads the data for a given scan object from Sardana NeXus file.

check_nexus_file_exists()

Check if the nexus file is present and set self.nexus_file_exists.

clear_all_scan_data()

Clears the data for all scan objects in the scan_dict.

clear_scan_data(scan)

Clear the data for a given scan object.

get_all_scan_numbers()

Return the all scan number from the scan_dict.

get_last_scan_number()

Return the number of the last scan in the scan_dict.

get_nexus_file([mode])

Return the file handle to the NeXus file in a given mode`.

get_scan(scan_number[, read_data, ...])

Returns a scan object from the scan dict determined by the scan_number.

get_scan_data(scan_number)

Returns data and meta information from a scan object from the scan_dict determined by the scan_number.

get_scan_list(scan_number_list[, read_data])

Returns a list of scan object from the scan_dict determined by the list of scan_number.

get_scan_list_data(scan_number_list)

Returns data and meta information for a list of scan objects from the scan_dict determined by the scan_numbers.

parse_nexus()

Parse the nexus file and populate the scan_dict.

read_all_scan_data()

Reads the data for all scan objects in the scan_dict from source.

read_nexus_scan_data(scan)

Reads the data for a given scan object from the nexus file.

read_scan_data(scan)

Reads the data for a given scan object.

save_all_scans_to_nexus()

Saves all scan objects in the scan_dict to the nexus file.

save_scan_to_nexus(scan[, nxs_file])

Saves a scan to the nexus file.

update([scan_number_list])

update the scan_dict either from the raw source file/folder or from the nexus file.

parse_raw()[source]#

Parse the Sardana NeXus file and populate the scan_dict.

read_raw_scan_data(scan)[source]#

Reads the data for a given scan object from Sardana NeXus file.

Parameters

scan (Scan) – scan object.

check_nexus_file_exists()#

Check if the nexus file is present and set self.nexus_file_exists.

clear_all_scan_data()#

Clears the data for all scan objects in the scan_dict.

clear_scan_data(scan)#

Clear the data for a given scan object.

Parameters

scan (Scan) – scan object.

get_all_scan_numbers()#

Return the all scan number from the scan_dict.

get_last_scan_number()#

Return the number of the last scan in the scan_dict. If the scan_dict is empty return 0.

get_nexus_file(mode='rw')#

Return the file handle to the NeXus file in a given mode`.

Parameters

mode (str, optional) – file mode. defaults to ‘rw’.

Returns

nxs_file (NXFile) – file handle to NeXus file.

get_scan(scan_number, read_data=True, dismiss_update=False)#

Returns a scan object from the scan dict determined by the scan_number.

Parameters
  • scan_number (uint) – number of the scan.

  • read_data (bool, optional) – read data from source. Defaults to False.

  • dismiss_update (bool, optional) – Dismiss update even if set as object attribute. Defaults to False.

Returns

scan (Scan) – scan object.

get_scan_data(scan_number)#

Returns data and meta information from a scan object from the scan_dict determined by the scan_number.

Parameters

scan_number (uint) – number of the scan.

Returns

data (numpy.recarray[float]) – scan data. meta (dict()): scan meta information.

get_scan_list(scan_number_list, read_data=True)#

Returns a list of scan object from the scan_dict determined by the list of scan_number.

Parameters
  • scan_number_list (list(uint)) – list of numbers of the scan.

  • read_data (bool, optional) – read data from source. Defaults to False.

Returns

scans (list(Scan)) – list of scan object.

get_scan_list_data(scan_number_list)#

Returns data and meta information for a list of scan objects from the scan_dict determined by the scan_numbers.

Parameters

scan_number_list (list(uint)) – list of numbers of the scan.

Returns

data (list(numpy.recarray[float])) – list of scan data. meta (list(dict())): list scan meta information.

parse_nexus()#

Parse the nexus file and populate the scan_dict.

read_all_scan_data()#

Reads the data for all scan objects in the scan_dict from source.

read_nexus_scan_data(scan)#

Reads the data for a given scan object from the nexus file.

Parameters

scan (Scan) – scan object.

read_scan_data(scan)#

Reads the data for a given scan object.

Parameters

scan (Scan) – scan object.

save_all_scans_to_nexus()#

Saves all scan objects in the scan_dict to the nexus file.

save_scan_to_nexus(scan, nxs_file='')#

Saves a scan to the nexus file.

update(scan_number_list=[])#

update the scan_dict either from the raw source file/folder or from the nexus file. The optional scan_number_list runs the update only if required for the included scan.

Attributes

scan_number_list (list[int]) – explicit list of scans

class pyEvalData.io.PalH5(name, file_name, file_path, **kwargs)[source]#

Bases: pyEvalData.io.source.Source

Source implementation for PalH5 folder/files.

Parameters
  • name (str) – name of the source

  • file_name (str) – file name including extension, can include regex pattern.

  • file_path (str, optional) – file path - defaults to ./.

Keyword Arguments
  • start_scan_number (uint) – start of scan numbers to parse.

  • stop_scan_number (uint) – stop of scan numbers to parse. This number is included.

  • nexus_file_name (str) – name for generated nexus file.

  • nexus_file_name_postfix (str) – postfix for nexus file name.

  • nexus_file_path (str) – path for generated nexus file.

  • read_all_data (bool) – read all data on parsing. If false, data will be read only on demand.

  • read_and_forget (bool) – clear data after read to save memory.

  • update_before_read (bool) – always update from source before reading scan data.

  • use_nexus (bool) – use nexus file to join/compress raw data.

  • force_overwrite (bool) – forced re-read of raw source and re-generated of nexus file.

Attributes
  • log (logging.logger) – logger instance from logging.

  • name (str) – name of the source

  • scan_dict (dict(scan)) – dict of scan objects with key being the scan number.

  • start_scan_number (uint) – start of scan numbers to parse.

  • stop_scan_number (uint) – stop of scan numbers to parse. This number is included.

  • file_name (str) – file name including extension, can include regex pattern.

  • file_path (str, optional) – file path - defaults to ./.

  • nexus_file_name (str) – name for generated nexus file.

  • nexus_file_name_postfix (str) – postfix for nexus file name.

  • nexus_file_path (str) – path for generated nexus file.

  • nexus_file_exists (bool) – if nexus file exists.

  • read_all_data (bool) – read all data on parsing.

  • read_and_forget (bool) – clear data after read to save memory.

  • update_before_read (bool) – always update from source before reading scan data.

  • use_nexus (bool) – use nexus file to join/compress raw data.

  • force_overwrite (bool) – forced re-read of raw source and re-generated of nexus file.

Methods:

parse_raw()

Parse the PalH5 folder and populate the scan_dict.

read_raw_scan_data(scan)

Reads the data for a given scan object from Sardana NeXus file.

check_nexus_file_exists()

Check if the nexus file is present and set self.nexus_file_exists.

clear_all_scan_data()

Clears the data for all scan objects in the scan_dict.

clear_scan_data(scan)

Clear the data for a given scan object.

get_all_scan_numbers()

Return the all scan number from the scan_dict.

get_last_scan_number()

Return the number of the last scan in the scan_dict.

get_nexus_file([mode])

Return the file handle to the NeXus file in a given mode`.

get_scan(scan_number[, read_data, ...])

Returns a scan object from the scan dict determined by the scan_number.

get_scan_data(scan_number)

Returns data and meta information from a scan object from the scan_dict determined by the scan_number.

get_scan_list(scan_number_list[, read_data])

Returns a list of scan object from the scan_dict determined by the list of scan_number.

get_scan_list_data(scan_number_list)

Returns data and meta information for a list of scan objects from the scan_dict determined by the scan_numbers.

parse_nexus()

Parse the nexus file and populate the scan_dict.

read_all_scan_data()

Reads the data for all scan objects in the scan_dict from source.

read_nexus_scan_data(scan)

Reads the data for a given scan object from the nexus file.

read_scan_data(scan)

Reads the data for a given scan object.

save_all_scans_to_nexus()

Saves all scan objects in the scan_dict to the nexus file.

save_scan_to_nexus(scan[, nxs_file])

Saves a scan to the nexus file.

update([scan_number_list])

update the scan_dict either from the raw source file/folder or from the nexus file.

parse_raw()[source]#

Parse the PalH5 folder and populate the scan_dict.

read_raw_scan_data(scan)[source]#

Reads the data for a given scan object from Sardana NeXus file.

Parameters

scan (Scan) – scan object.

check_nexus_file_exists()#

Check if the nexus file is present and set self.nexus_file_exists.

clear_all_scan_data()#

Clears the data for all scan objects in the scan_dict.

clear_scan_data(scan)#

Clear the data for a given scan object.

Parameters

scan (Scan) – scan object.

get_all_scan_numbers()#

Return the all scan number from the scan_dict.

get_last_scan_number()#

Return the number of the last scan in the scan_dict. If the scan_dict is empty return 0.

get_nexus_file(mode='rw')#

Return the file handle to the NeXus file in a given mode`.

Parameters

mode (str, optional) – file mode. defaults to ‘rw’.

Returns

nxs_file (NXFile) – file handle to NeXus file.

get_scan(scan_number, read_data=True, dismiss_update=False)#

Returns a scan object from the scan dict determined by the scan_number.

Parameters
  • scan_number (uint) – number of the scan.

  • read_data (bool, optional) – read data from source. Defaults to False.

  • dismiss_update (bool, optional) – Dismiss update even if set as object attribute. Defaults to False.

Returns

scan (Scan) – scan object.

get_scan_data(scan_number)#

Returns data and meta information from a scan object from the scan_dict determined by the scan_number.

Parameters

scan_number (uint) – number of the scan.

Returns

data (numpy.recarray[float]) – scan data. meta (dict()): scan meta information.

get_scan_list(scan_number_list, read_data=True)#

Returns a list of scan object from the scan_dict determined by the list of scan_number.

Parameters
  • scan_number_list (list(uint)) – list of numbers of the scan.

  • read_data (bool, optional) – read data from source. Defaults to False.

Returns

scans (list(Scan)) – list of scan object.

get_scan_list_data(scan_number_list)#

Returns data and meta information for a list of scan objects from the scan_dict determined by the scan_numbers.

Parameters

scan_number_list (list(uint)) – list of numbers of the scan.

Returns

data (list(numpy.recarray[float])) – list of scan data. meta (list(dict())): list scan meta information.

parse_nexus()#

Parse the nexus file and populate the scan_dict.

read_all_scan_data()#

Reads the data for all scan objects in the scan_dict from source.

read_nexus_scan_data(scan)#

Reads the data for a given scan object from the nexus file.

Parameters

scan (Scan) – scan object.

read_scan_data(scan)#

Reads the data for a given scan object.

Parameters

scan (Scan) – scan object.

save_all_scans_to_nexus()#

Saves all scan objects in the scan_dict to the nexus file.

save_scan_to_nexus(scan, nxs_file='')#

Saves a scan to the nexus file.

update(scan_number_list=[])#

update the scan_dict either from the raw source file/folder or from the nexus file. The optional scan_number_list runs the update only if required for the included scan.

Attributes

scan_number_list (list[int]) – explicit list of scans