:py:mod:`nessai.flowsampler` ============================ .. py:module:: nessai.flowsampler .. autoapi-nested-parse:: Main code that handles running and checkpoiting the sampler. .. !! processed by numpydoc !! Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: nessai.flowsampler.FlowSampler Attributes ~~~~~~~~~~ .. autoapisummary:: nessai.flowsampler.logger .. py:data:: logger .. !! processed by numpydoc !! .. py:class:: 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** : :obj:`nessai.model.Model` User-defined model. **output** : str, optional Output directory **resume** : bool, optional If True try to resume the sampler is the resume file exists. **resume_file** : str, optional File to resume sampler from. **weights_files** : str, optional Weights files used to resume sampler that replaces the weights file saved internally. **max_threads** : int, optional Maximum number of threads to use. If ``None`` torch uses all available threads. **signal_handling** : bool Enable or disable signal handling. **exit_code** : int, optional Exit code to use when forceably exiting the sampler. **kwargs** Keyword arguments passed to :obj:`~nessai.nestedsampler.NestedSampler`. .. !! processed by numpydoc !! .. py:method:: run(self, plot=True, save=True) Run the nested samper :Parameters: **plot** : bool, optional Toggle plots produced once the sampler has converged **save** : bool, optional Toggle automatic saving of results .. !! processed by numpydoc !! .. py:method:: save_kwargs(self, kwargs) Save the dictionary of keyword arguments used. Uses an encoder class to handle numpy arrays. :Parameters: **kwargs** : dict Dictionary of kwargs to save. .. !! processed by numpydoc !! .. py:method:: save_results(self, filename) Save the results from sampling to a specific JSON file. :Parameters: **filename** : str Name of file to save results to. .. !! processed by numpydoc !! .. py:method:: safe_exit(self, signum=None, frame=None) Safely exit. This includes closing the multiprocessing pool. .. !! processed by numpydoc !!