autofit.DatabasePaths#
- class DatabasePaths[source]#
Bases:
AbstractPathsManages the path structure for NonLinearSearch output, for analyses both not using and using the search API. Use via non-linear searches requires manual input of paths, whereas the search API manages this using the search attributes.
The output path within which the Paths objects path structure is contained is set via PyAutoConf, using the command:
from autoconf import conf conf.instance = conf.Config(output_path=”path/to/output”)
If we assume all the input strings above are used with the following example names:
name = “name” path_prefix = “folder_0/folder_1”
The output path of the NonLinearSearch results will be:
/path/to/output/folder_0/folder_1/name
If the
PYAUTO_TEST_MODEenvironment variable is set, atest_modesegment is inserted directly after the output root:/path/to/output/test_mode/folder_0/folder_1/name
This keeps smoke-test artefacts in a sibling tree so they cannot be picked up by a later real run with the same paths.
- Parameters:
name (
Optional[str]) – The name of the non-linear search, which is used as a folder name after thepath_prefix. For searchs this name is thename.path_prefix (
Optional[str]) – A prefixed path that appears after the output_path but before the name variable.is_identifier_in_paths – If True output path and symlink path terminate with an identifier generated from the search and model
parent – The parent paths object of this paths object.
unique_tag (
Optional[str]) – A unique tag for the search, used to differentiate between searches with the same name.identifier – A custom identifier for the search, if this is not None it will be used instead of the automatically generated identifier
image_path_suffix – A suffix which is appended to the image path. This is used to differentiate between different image outputs, for example the image of the starting point of an MLE.
Methods
Create a paths object which is the child of some parent paths object.
for_sub_analysisLoad an array from the database
Load a fits file from the database
Load a json file from the database
Load samples from the database
load_samples_summaryLoad samples summary from the database.
output_model_resultsrestoreCopy files from the
.zipfile to the samples folder.Save an array as a json file in the database
Save a fits file in the database
save_identifierSave a dictionary as a json file in the database
Save latent variables.
save_parent_identifierSave samples to the database
save_samples_summarySave samples summary to the database.
save_unique_tagRemove files from both the symlinked folder and the output directory
Attributes
identifierimage_pathThe path to the image folder.
non_linear_nameoutput_pathThe path to the output information for a search.
The search performed before this search.
profile_pathThe path to the profile folder.
search_internal_pathThe path to the samples folder.
- property parent: AbstractPaths#
The search performed before this search. For example, a search that is then compared to searches during a grid search.
- create_child(name=None, path_prefix=None, is_identifier_in_paths=None, identifier=None)[source]#
Create a paths object which is the child of some parent paths object. This is done during a GridSearch so that results can be stored in the correct directory. It also allows database fit objects to be related correctly.
If no instance is set the prior median model is used to ensure that the parent object is queryable.
- load_json(name, prefix='')[source]#
Load a json file from the database
- Parameters:
name (
str) – The name of the json- Return type:
The loaded dictionary
- property samples#
- save_array(name, array)[source]#
Save an array as a json file in the database
- Parameters:
name – The name of the array
array (
ndarray) – The array to save
- load_array(name)[source]#
Load an array from the database
- Parameters:
name (
str) – The name of the array- Return type:
The loaded array
- save_fits(name, fits, prefix='')[source]#
Save a fits file in the database
- Parameters:
name (
str) – The name of the fits filefits – The fits file to save
- load_fits(name, prefix='')[source]#
Load a fits file from the database
- Parameters:
name (
str) – The name of the fits file- Return type:
The loaded hdu
- property fit: Fit#
- save_summary(samples, latent_samples, log_likelihood_function_time, visualization_time=None)[source]#