autofit.DatabasePaths#
- class autofit.DatabasePaths(session, name: Optional[str] = None, path_prefix: Optional[str] = None, is_identifier_in_paths=True, parent=None, save_all_samples=False, unique_tag: Optional[str] = None)[source]#
Bases:
AbstractPaths
Manages 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
- Parameters:
name – The name of the non-linear search, which is used as a folder name after the
path_prefix
. For searchs this name is thename
.path_prefix – 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
Methods
completed
Create a paths object which is the child of some parent paths object.
for_sub_analysis
is_object
Load an array from the database
Load a fits file from the database
Load a json file from the database
load_latent_samples
load_object
Load samples from the database
load_samples_info
load_samples_summary
Load samples summary from the database.
load_search_internal
remove_object
remove_search_internal
restore
Copy files from the
.zip
file to the samples folder.save_all
Save an array as a json file in the database
Save a fits file in the database
save_identifier
Save a dictionary as a json file in the database
Save latent variables.
save_object
save_parent_identifier
Save samples to the database
save_samples_summary
Save samples summary to the database.
save_search_internal
save_summary
save_unique_tag
Remove files from both the symlinked folder and the output directory
zip_remove_nuclear
When multiple model-fits are performed using the same path_prefix and name, the results are populated in the same folder with different unique identifiers.
Attributes
fit
identifier
image_path
The path to the image folder.
is_complete
is_grid_search
non_linear_name
output_path
The path to the output information for a search.
The search performed before this search.
profile_path
The path to the profile folder.
samples
search_internal_path
The 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: Optional[str] = None, path_prefix: Optional[str] = None, is_identifier_in_paths: Optional[bool] = None, identifier: Optional[str] = None) DatabasePaths [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.
- Parameters:
identifier –
name –
path_prefix –
is_identifier_in_paths – If False then this path’s identifier will not be added to its output path.
- Return type:
A new paths object
- save_json(name, object_dict: Union[dict, list], prefix: str = '')[source]#
Save a dictionary as a json file in the database
- Parameters:
name – The name of the json
object_dict – The dictionary to save
- load_json(name: str, prefix: str = '') Union[dict, list] [source]#
Load a json file from the database
- Parameters:
name – The name of the json
- Return type:
The loaded dictionary
- save_array(name, array: ndarray)[source]#
Save an array as a json file in the database
- Parameters:
name – The name of the array
array – The array to save
- load_array(name: str) ndarray [source]#
Load an array from the database
- Parameters:
name – The name of the array
- Return type:
The loaded array
- save_fits(name: str, hdu, prefix: str = '')[source]#
Save a fits file in the database
- Parameters:
name – The name of the fits file
hdu – The hdu to save
- load_fits(name: str, prefix: str = '')[source]#
Load a fits file from the database
- Parameters:
name – The name of the fits file
- Return type:
The loaded hdu