cfg Reader¶
- class pydiana.scripting.cfg_reader.averagecfg(cfg_file, other_flags='', all=False)[source]¶
Bases:
sequencecfgClass for dealing with sequences that build average quantites. Made mainly for averagepulse and averagenoise.
- find_all_files()[source]¶
Finds all the files in the .list file
- Returns:
List with the files in the list.
- class pydiana.scripting.cfg_reader.sequencecfg(cfg_file, other_flags='')[source]¶
Bases:
object- complete_line(line)[source]¶
Function for completing the line in the cfg by inserting the value of the variable.
- Parameters:
(str) (line) --
- Returns:
The completed line or None if not successful.
- find_all_substr_occur(line, substr)[source]¶
Function for finding a substring in a string.
- Parameters:
(str) (substr) --
(str) --
- Returns:
List of indexes with the positions in which the substring was found
- find_line_value(line, content)[source]¶
Find value after the '=' sign in a cfg line
- Parameters:
(str) (line) --
- Returns:
String with the parameter value, the string is empty if the parameter is not found.
- find_var_pos_in_line(line)[source]¶
Utility function for finding variable position in the line of the cfg.
- findcfg(cfg)[source]¶
This function searces the cfg in the DIANA_EXT_INSTALL/cfg and DIANA_INSTALL/cfg folders. If a path is provided (relative or absolute) then the search is not performed
- Parameters:
(str) (cfg) --
- Return type:
str- Returns:
String with path to cfg. If not Found returns None.
- get_calls()[source]¶
Get all the calls from the cfg.
- Returns:
Returns list with all the generated bash calls.
- get_core_filename()[source]¶
Get run formatted for output file
- Returns:
None if run is not set else returns the string of the run.
- get_input_file()[source]¶
Get inputfile line from reader of cfg.
- Returns:
string containing the input file value.
- get_module(name)[source]¶
Getting a specific module from the cfg.
TODO: probably needs perfecting.
- Parameters:
(str) (name) --
- Returns:
List containing the lines regarding the module
- get_output_file()[source]¶
Get outputfile line from writer of cfg.
- Returns:
string containing the output file value.
- get_reader()[source]¶
Function for getting reader of the cfg.
- Returns:
List containing the lines regarding the module
- get_var(name)[source]¶
Function for getting the content of a cfg variable
- Parameters:
(str) (name) --
- Returns:
Value of the parameter or None if the parameter is not found
- get_writer()[source]¶
Function for getting writer of the cfg.
- Returns:
List containing the lines regarding the module
- make_diana_call(optional_args=None)[source]¶
Function for making the diana bash call for this sequence.
- Parameters:
(str) (optional_args) --
- Returns:
True if everything is successfull otherwise False
- run_cfg()[source]¶
Function for running the cfg bash call using subprocess.
- Returns:
The result of the diana call
- sequence_name()[source]¶
Read sequence name from cfg
- Return type:
bool- Returns:
Returns True if the name was found else returns False