mcstasscript.helper.beam_dump_database.BeamDumpDatabase
mcstasscript.helper.beam_dump_database.BeamDumpDatabase¶
- class mcstasscript.helper.beam_dump_database.BeamDumpDatabase(name, path)¶
- __init__(name, path)¶
- Database over location and run properties of beam dumps - namestr
- Name of instrument for which this database is connected 
- pathstr
- input_path for instrument, database is placed there 
 
 - Methods - __init__(name, path)- Database over location and run properties of beam dumps - create_folder_for_dump_point(dump_point)- Adds folder to database for dump_point if it hasn't been made yet - create_new_database(path)- Creates directory for database, may be expanded in future - get_dump(point[, run_name, tag])- Getter for dumps with specified point, run_name and tag - load_data(expected_filename, ...)- Include MCPL file into database with given metadata - load_database(path)- Loads an existing database from disk - newest_at_point(point[, run])- Gets newest dump at a given point and optionally a run_name - show_in_order(component_names)- Method to print content of database in order of component_names - sort_by_time(runs[, return_latest])- Sorts a given dict of runs and returns a list or the latest if return_latest is true - create_folder_for_dump_point(dump_point)¶
- Adds folder to database for dump_point if it hasn’t been made yet - Returns path to the folder whether it was created here or existed 
 - create_new_database(path)¶
- Creates directory for database, may be expanded in future 
 - get_dump(point, run_name=None, tag=None)¶
- Getter for dumps with specified point, run_name and tag 
 - load_data(expected_filename, data_folder_path, parameters, run_name, dump_point, comment)¶
- Include MCPL file into database with given metadata - Attempts to load MCPL file from McStas output. If the file does not exists, the method will return without adding anything to the database. - expected_filenamestr
- Filename given as McStas parameter, can include explicit double quotes 
- data_folder_pathstr
- Path to the data folder that contains the MCPL file 
- parameters: dict
- dict with parameter names and values for this run 
- run_namestr
- Specified run name for this run 
- dump_pointstr
- Name of component where MCPL cut ended, can start from here later 
- commentstr
- Comment on the run that can be included in metadata 
 
 - load_database(path)¶
- Loads an existing database from disk - pathstr
- Path for the database to be loaded 
 
 - newest_at_point(point, run=None)¶
- Gets newest dump at a given point and optionally a run_name - pointstr
- String with component name matching the dump point 
- runstr
- String matching the run_name desired 
 
 - show_in_order(component_names)¶
- Method to print content of database in order of component_names - component_nameslist
- List of strings for component names in the instrument 
 
 - sort_by_time(runs, return_latest=False)¶
- Sorts a given dict of runs and returns a list or the latest if return_latest is true - The input data is given as a dictionary of runs matching the database structure with all the individual tags underneath the runs. It is usually used with all runs being from the same point, but not necessary for the method to work. - runsdict
- Dictionary with runs containing dictionary of tags pointing to dumps 
- return_latestbool
- If True only latest dump is returned, otherwise sorted list