示例#1
0
    def to_hdf(self, path_or_buf, path=''):
        """
        Store the runner to an HDF structure.

        Parameters
        ----------
        path_or_buf:
            Path or buffer to the HDF store
        path:
            Path inside the HDF store to store the runner
        Returns
        -------
            : None

        """
        runner_path = os.path.join(path, 'runner')
        properties = [
            'output_nu', 'output_energy', 'nu_bar_estimator', 'j_estimator',
            'montecarlo_virtual_luminosity', 'last_interaction_in_nu',
            'last_line_interaction_in_id', 'last_line_interaction_out_id',
            'last_line_interaction_shell_id', 'packet_luminosity', 'output_nu'
        ]
        to_hdf(path_or_buf, runner_path,
               {name: getattr(self, name)
                for name in properties})
        self.spectrum.to_hdf(path_or_buf, runner_path)
        self.spectrum_virtual.to_hdf(path_or_buf, runner_path,
                                     'spectrum_virtual')
        self.spectrum_reabsorbed.to_hdf(path_or_buf, runner_path,
                                        'spectrum_reabsorbed')
示例#2
0
    def to_hdf(self, path_or_buf, path=''):
        """
        Store the runner to an HDF structure.

        Parameters
        ----------
        path_or_buf:
            Path or buffer to the HDF store
        path:
            Path inside the HDF store to store the runner
        Returns
        -------
            : None

        """
        runner_path = os.path.join(path, 'runner')
        properties = ['output_nu', 'output_energy', 'nu_bar_estimator',
                      'j_estimator']
        to_hdf(path_or_buf, runner_path, {name: getattr(self, name) for name
                                          in properties})
        self.spectrum.to_hdf(path_or_buf, runner_path)
        self.spectrum_virtual.to_hdf(path_or_buf, runner_path,
                                     'spectrum_virtual')
        self.spectrum_reabsorbed.to_hdf(path_or_buf, runner_path,
                                        'spectrum_reabsorbed')
示例#3
0
    def to_hdf(self, path_or_buf, path='', name=''):
        """
        Store the spectrum to an HDF structure.

        Parameters
        ----------
        path_or_buf
            Path or buffer to the HDF store
        path : str
            Path inside the HDF store to store the spectrum
        name : str, optional
            A different name than 'spectrum', if needed.

        Returns
        -------
        None

        """
        if not name:
            name = 'spectrum'
        spectrum_path = os.path.join(path, name)
        properties = [
            'luminosity_density_nu', 'delta_frequency', 'wavelength',
            'luminosity_density_lambda'
        ]
        to_hdf(path_or_buf, spectrum_path,
               {name: getattr(self, name)
                for name in properties})
示例#4
0
    def to_hdf(self, path_or_buf, path=''):
        """
        Store the runner to an HDF structure.

        Parameters
        ----------
        path_or_buf:
            Path or buffer to the HDF store
        path:
            Path inside the HDF store to store the runner
        Returns
        -------
            : None

        """
        runner_path = os.path.join(path, 'runner')
        properties = [
            'output_nu', 'output_energy', 'nu_bar_estimator', 'j_estimator'
        ]
        to_hdf(path_or_buf, runner_path,
               {name: getattr(self, name)
                for name in properties})
        self.spectrum.to_hdf(path_or_buf, runner_path)
        self.spectrum_virtual.to_hdf(path_or_buf, runner_path,
                                     'spectrum_virtual')
        self.spectrum_reabsorbed.to_hdf(path_or_buf, runner_path,
                                        'spectrum_reabsorbed')
示例#5
0
文件: model.py 项目: talytha/tardis
    def to_hdf(self, path_or_buf, path='', plasma_properties=None):
        """
        Store the model to an HDF structure.

        Parameters
        ----------
        path_or_buf
            Path or buffer to the HDF store
        path : str
            Path inside the HDF store to store the model
        plasma_properties
            `None` or a `PlasmaPropertyCollection` which will
            be passed as the collection argument to the
            plasma.to_hdf method.

        Returns
        -------
        None

        """
        model_path = os.path.join(path, 'model')
        properties = ['t_inner', 'ws', 't_rads', 'v_inner', 'v_outer']
        to_hdf(path_or_buf, model_path, {name: getattr(self, name) for name
                                         in properties})

        self.plasma.to_hdf(path_or_buf, model_path, plasma_properties)

        metadata = pd.Series({'atom_data_uuid': self.atom_data.uuid1})
        metadata.to_hdf(path_or_buf,
                                 os.path.join(model_path, 'metadata'))
示例#6
0
文件: base.py 项目: kush789/tardis
    def to_hdf(self, path_or_buf, path=''):
        """
        Store the runner to an HDF structure.

        Parameters
        ----------
        path_or_buf:
            Path or buffer to the HDF store
        path:
            Path inside the HDF store to store the runner
        Returns
        -------
            : None

        """
        runner_path = os.path.join(path, 'runner')
        properties = ['output_nu', 'output_energy', 'nu_bar_estimator',
                      'j_estimator', 'montecarlo_virtual_luminosity',
                      'last_interaction_in_nu',
                      'last_line_interaction_in_id',
                      'last_line_interaction_out_id',
                      'last_line_interaction_shell_id',
                      'packet_luminosity', 'output_nu'
                      ]
        to_hdf(path_or_buf, runner_path, {name: getattr(self, name) for name
                                          in properties})
        self.spectrum.to_hdf(path_or_buf, runner_path)
        self.spectrum_virtual.to_hdf(path_or_buf, runner_path,
                                     'spectrum_virtual')
        self.spectrum_reabsorbed.to_hdf(path_or_buf, runner_path,
                                        'spectrum_reabsorbed')
示例#7
0
    def to_hdf(self, path_or_buf, path):
        """
        Stores plugin value to an HDFStore

        Parameters
        ----------
        path_or_buf:
            Path or buffer to the HDF store
        path: ~str
            path to store the modules data under
            - will be joined to <path>/output_name

        Returns
        -------
            : None

        """
        outputs = {name: getattr(self, name) for name in self.outputs}
        to_hdf(path_or_buf, path, outputs)
示例#8
0
文件: base.py 项目: kush789/tardis
    def to_hdf(self, path_or_buf, path):
        """
        Stores plugin value to an HDFStore

        Parameters
        ----------
        path_or_buf:
            Path or buffer to the HDF store
        path: ~str
            path to store the modules data under
            - will be joined to <path>/output_name

        Returns
        -------
            : None

        """
        outputs = {name: getattr(self, name) for name in self.outputs}
        to_hdf(path_or_buf, path, outputs)
示例#9
0
文件: base.py 项目: kush789/tardis
    def to_hdf(self, path_or_buf, path=''):
        """
        Store the model to an HDF structure.

        Parameters
        ----------
        path_or_buf
            Path or buffer to the HDF store
        path : str
            Path inside the HDF store to store the model

        Returns
        -------
        None

        """
        model_path = os.path.join(path, 'model')
        properties = ['t_inner', 'w', 't_radiative', 'v_inner', 'v_outer']
        to_hdf(path_or_buf, model_path, {name: getattr(self, name) for name
                                         in properties})
示例#10
0
    def to_hdf(self, path_or_buf, path=''):
        """
        Store the model to an HDF structure.

        Parameters
        ----------
        path_or_buf
            Path or buffer to the HDF store
        path : str
            Path inside the HDF store to store the model

        Returns
        -------
        None

        """
        model_path = os.path.join(path, 'model')
        properties = ['t_inner', 'w', 't_radiative', 'v_inner', 'v_outer']
        to_hdf(path_or_buf, model_path,
               {name: getattr(self, name)
                for name in properties})
示例#11
0
    def to_hdf(self, path_or_buf, path="", name=""):
        """
        Store the spectrum to an HDF structure.

        Parameters
        ----------
        path_or_buf
            Path or buffer to the HDF store
        path : str
            Path inside the HDF store to store the spectrum
        name : str, optional
            A different name than 'spectrum', if needed.

        Returns
        -------
        None

        """
        if not name:
            name = "spectrum"
        spectrum_path = os.path.join(path, name)
        properties = ["luminosity_density_nu", "delta_frequency", "wavelength", "luminosity_density_lambda"]
        to_hdf(path_or_buf, spectrum_path, {name: getattr(self, name) for name in properties})