f311 package¶
Subpackages¶
Submodules¶
f311.collaboration module¶
Collaboration-related routines
Class Catalog – resources to retrieve File* classes by different criteria
Script utilities: collect scripts (standalone applications) across collaborator packages
- f311.collaboration.classes_bin()¶
Classes to consider when attempts to load a binary file (see load_any_file())
- f311.collaboration.classes_file(flag_leaf=False)¶
All known File* classes
- Parameters:
flag_leaf – returns only classes that do not have subclasses (“leaf” nodes as in a class tree graph)
- f311.collaboration.classes_sp()¶
Classes to consider when attempts to load a spectrum file (see load_spectrum())
- f311.collaboration.classes_txt()¶
Classes to consider when attempts to load a text file (see load_any_file())
- f311.collaboration.get_programs_dict(pkgname_only=None, flag_protected=False)¶
Scans COLLABORATORS_S packages for scripts, eventually filtering if arguments passed
- Parameters:
pkgname_only – name of single package within COLLABORATORS_S
flag_protected – include scripts starting with “_”?
- Returns:
{“packagename0”: {“exeinfo”: [ExeInfo00, …], “description”: description0}, …}
- Return type:
dictionary
- f311.collaboration.get_scripts_path(packagename)¶
Convention Returns full path to scripts directory
- f311.collaboration.get_suitable_vis_classes(obj)¶
Retuns a list of Vis classes that can handle obj.
- f311.collaboration.get_suitable_vis_list_classes(objs)¶
Retuns a list of VisList classes that can handle a list of objects.
f311.pathfinder module¶
- f311.pathfinder.copy_default_data_file(filename, module=None)¶
Copies file from default data directory to local directory.
- f311.pathfinder.get_default_data_path(*args, module=None, class_=None, flag_raise=True)¶
Returns path to default data directory
Arguments ‘module’ and ‘class’ give the chance to return path relative to package other than f311.filetypes
- Parameters:
module – Python module object. It is expected that this module has a sub-subdirectory named ‘data/default’
class – Python class object to extract path information from. If this argument is used, it will be expected that the class “root” package will have a sub-subdirectory named ‘data/default’. Argument ‘class_’ has precedence over argument ‘module’
flag_raise – raises error if file is not found. This can be turned off for whichever purpose
f311.util module¶
Miscellanea routines that depend on other modules and sub-packages.
- f311.util.filetypes_info_to_rows_header(infos, attrnames=None, header=None, flag_wrap_description=False, description_width=40)¶
Converts filetype information to a (multiline_rows, header) tuple that can be more easily be tabulated
- Attention uses ReST syntax, using a “
” marker for line break. It requires the .rst source file to contain the following bit:
- Parameters:
infos – list of FileTypeInfo
attrnames – list of attribute names (keys of FILE_TYPE_INFO_ATTRS). Defaults to all attributes
header – list of strings containing headers. If not passed, uses default names
flag_wrap_description – whether to wrap the description text
description_width – width to wrap the description text (effective only if flag_wrap_description is True)
- Returns:
(rows, header): rows is a list of lists
- Return type:
tuple
- Attention uses ReST syntax, using a “
- f311.util.get_filetypes_info(editor_quote='`', flag_leaf=True)¶
Reports available data types
- Parameters:
editor_quote – character to enclose the name of the editor script between.
flag_leaf – see tabulate_filetypes_rest()
- Returns:
list of FileTypeInfo
- Return type:
list
- f311.util.load(filename, class_)¶
Attempts to load file using a specific DataFile descendant.
- Parameters:
file (filename -- full path to) –
descendant (class -- a DataFile) –
load (or at least a class having method) –
Returns: DataFile object if loaded successfully, or None if not.
- f311.util.load_any_file(filename)¶
Attempts to load filename by trial-and-error
- Returns:
A DataFile descendant, whose specific class depends on the file format detected, or None if the file canonot be loaded
- Return type:
file
- f311.util.load_spectrum(filename)¶
Attempts to load spectrum as one of the supported types.
- Returns:
a Spectrum, or None
- f311.util.load_spectrum_fits_messed_x(filename, sp_ref=None)¶
Loads FITS file spectrum that does not have the proper headers. Returns a Spectrum
- f311.util.load_with_classes(filename, classes)¶
Attempts to load file by trial-and-error using a given list of classes.
- Parameters:
file (filename -- full path to) –
method (classes -- list of classes having a load()) –
Returns: DataFile object if loaded successfully, or None if not.
Note: it will stop at the first successful load.
Attention: this is not good if there is a bug in any of the file readers, because all exceptions will be silenced!
- f311.util.tabulate_filetypes_rest(attrnames=None, header=None, flag_wrap_description=True, description_width=40, flag_leaf=True)¶
Generates a reST multirow table
- Parameters:
attrnames – list of attribute names (keys of FILE_TYPE_INFO_ATTRS). Defaults to all attributes
header – list of strings containing headers. If not passed, uses default names
flag_wrap_description – whether to wrap the description text
description_width – width to wrap the description text (effective only if flag_wrap_description is True)
flag_leaf – returns only classes that do not have subclasses (“leaf” nodes as in a class tree graph)
Module contents¶
Project f311