nessai.flowsampler
Main code that handles running and checkpoiting the sampler.
Module Contents
Classes
Main class to handle running the nested sampler. |
Attributes
- nessai.flowsampler.logger
- class nessai.flowsampler.FlowSampler(model, output='./', resume=True, resume_file='nested_sampler_resume.pkl', weights_file=None, signal_handling=True, exit_code=130, max_threads=1, **kwargs)
Main class to handle running the nested sampler.
- Parameters
- model
nessai.model.Model
User-defined model.
- outputstr, optional
Output directory
- resumebool, optional
If True try to resume the sampler is the resume file exists.
- resume_filestr, optional
File to resume sampler from.
- weights_filesstr, optional
Weights files used to resume sampler that replaces the weights file saved internally.
- max_threadsint, optional
Maximum number of threads to use. If
None
torch uses all available threads.- signal_handlingbool
Enable or disable signal handling.
- exit_codeint, optional
Exit code to use when forceably exiting the sampler.
- kwargs
Keyword arguments passed to
NestedSampler
.
- model
- run(self, plot=True, save=True)
Run the nested samper
- Parameters
- plotbool, optional
Toggle plots produced once the sampler has converged
- savebool, optional
Toggle automatic saving of results
- save_kwargs(self, kwargs)
Save the dictionary of keyword arguments used.
Uses an encoder class to handle numpy arrays.
- Parameters
- kwargsdict
Dictionary of kwargs to save.
- save_results(self, filename)
Save the results from sampling to a specific JSON file.
- Parameters
- filenamestr
Name of file to save results to.
- safe_exit(self, signum=None, frame=None)
Safely exit. This includes closing the multiprocessing pool.