SourceCalculators
- module GaussianSourceCalculator:
Module that holds the GaussianSourceCalculator class.
- class SimExLite.SourceCalculators.GaussianSourceCalculator.GaussianSourceCalculator(name: str, output_keys: str = 'Gaussian_wavefront', output_filenames: str = 'wavefront.h5', instrument_base_dir='./', calculator_base_dir='GaussianSourceCalculator', parameters=None)[source]
Class calculating a x-ray free electron laser photon source under the gaussian assumption.
- Parameters:
name (str) – The name of this calculator.
output_keys (str, optional) – The key(s) of this calculator’s output data. It’s a list of ``str``s or a single str. Defaults to “Gaussian_wavefront”.
output_filenames (str, optional) – The output filename of this calculator. Defaults to “wavefront.h5”. instrument_base_dir (str, optional): The base directory for the instrument to which this calculator belongs. Defaults to “./”. The final exact output file path depends on
instrument_base_dirandcalculator_base_dir:instrument_base_dir/calculator_base_dir/filename.calculator_base_dir (str, optional) – The base directory for this calculator. Defaults to “./”. The final exact output file path depends on instrument_base_dir and calculator_base_dir:
instrument_base_dir/calculator_base_dir/filename.
- property base_dir
The base path for the output files of this calculator in consideration of instrument_base_dir and calculator_base_dir
- property calculator_base_dir: str
The base directory for this calculator. The final exact output file path depends on instrument_base_dir and calculator_base_dir: instrument_base_dir/calculator_base_dir/filename
- property data
The alias of output. It’s not recommended to use this variable name due to it’s ambiguity.
- dump(fname: str | None = None) str
Dump class instance to file.
- Parameters:
fname – Filename (path) of the file to write.
- Returns:
The filename of the dumpfile
- classmethod from_dump(dumpfile: str)
Load a dill dump from a dumpfile.
- Parameters:
dumpfile – The file name of the dumpfile.
- Returns:
The calculator object restored from the dumpfile.
- init_parameters()[source]
Virtual method to initialize all parameters. Must be implemented on the specialized class.
- property input: DataCollection
The input of this calculator. A collection or a single Data Object(s).
- property instrument_base_dir: str
The base directory for the instrument to which this calculator belongs.
- property name: str
The name of this calculator.
- property output
The output of this calculator
- property output_data_types: list
The data type(s), i.e., classes, of each output.
- property output_file_paths
The final output file paths considering base_dir
- property output_filenames: list
The name(s) of the output file(s). It can be a str of a filename or a list of filenames. If the mapping is dict mapping, the name is None.
- property output_keys: list
The key(s) of this calculator’s output data.
- property parameters: CalculatorParameters
The parameters of this calculator.
- reset_parameters(value: CalculatorParameters)
Resets the calculator parameters
- set_calculator_base_dir(value: str)
Set the calculator base directory
- set_input(value: DataCollection | list | BaseData | None)
Set the calculator input data. It can be a DataCollection, list or BaseData object.
- set_instrument_base_dir(value: str)
Set the instrument base directory
- set_output_data_types(value: list | BaseData)
Set the calculator output data type. It can be a list of DataClass or a single DataClass.
- set_output_filenames(value: list | str | None)
Set the calculator output filenames. It can be a list of filenames or just a single str.
- set_output_keys(value: list | str)
Set the calculator output keys. It can be a list of str or a single str.
- set_parameters(args_as_dict: bool | None = None, **kwargs)
Sets parameters contained in this calculator using dict or kwargs