コード例 #1
0
ファイル: lightcurve.py プロジェクト: abigailStev/stingray
    def read(self, filename, format_='pickle'):
        """
        Read a :class:`Lightcurve` object from file. Currently supported formats are

        * pickle (not recommended for long-term storage)
        * HDF5
        * ASCII

        Parameters
        ----------
        filename: str
            Path and file name for the file to be read.

        format\_: str
            Available options are 'pickle', 'hdf5', 'ascii'

        Returns
        --------
        lc : ``astropy.table`` or ``dict`` or :class:`Lightcurve` object
            * If ``format\_`` is ``ascii``: ``astropy.table`` is returned.
            * If ``format\_`` is ``hdf5``: dictionary with key-value pairs is returned.
            * If ``format\_`` is ``pickle``: :class:`Lightcurve` object is returned.
        """

        if format_ == 'ascii' or format_ == 'hdf5':
            return io.read(filename, format_)

        elif format_ == 'pickle':
            self = io.read(filename, format_)

        else:
            utils.simon("Format not understood.")
コード例 #2
0
    def read(self, filename, format_='pickle'):
        """
        Imports LightCurve object.

        Parameters
        ----------
        filename: str
            Name of the LightCurve object to be read.

        format\_: str
            Available options are 'pickle', 'hdf5', 'ascii'

        Returns
        --------
        If format\_ is 'ascii': astropy.table is returned.
        If format\_ is 'hdf5': dictionary with key-value pairs is returned.
        If format\_ is 'pickle': class object is set.
        """

        if format_ == 'ascii' or format_ == 'hdf5':
            return io.read(filename, format_)

        elif format_ == 'pickle':
            self = io.read(filename, format_)

        else:
            utils.simon("Format not understood.")
コード例 #3
0
ファイル: lightcurve.py プロジェクト: marstaa/stingray
    def read(self, filename, format_='pickle'):
        """
        Read a :class:`Lightcurve` object from file. Currently supported formats are

        * pickle (not recommended for long-term storage)
        * HDF5
        * ASCII

        Parameters
        ----------
        filename: str
            Path and file name for the file to be read.

        format\_: str
            Available options are 'pickle', 'hdf5', 'ascii'

        Returns
        --------
        lc : ``astropy.table`` or ``dict`` or :class:`Lightcurve` object
            * If ``format\_`` is ``ascii``: ``astropy.table`` is returned.
            * If ``format\_`` is ``hdf5``: dictionary with key-value pairs is returned.
            * If ``format\_`` is ``pickle``: :class:`Lightcurve` object is returned.
        """

        if format_ == 'ascii' or format_ == 'hdf5':
            return io.read(filename, format_)

        elif format_ == 'pickle':
            self = io.read(filename, format_)

        else:
            utils.simon("Format not understood.")
コード例 #4
0
    def read(filename, format_='pickle'):
        """
        Imports Simulator object.

        Parameters
        ----------
        filename : str
            Name of the Simulator object to be read.

        format_ : str
            Available option is 'pickle.'

        Returns
        -------
        object : `Simulator` object
        """
        if format_ == 'pickle':
            data = read(filename, 'pickle')
            return data
        else:
            raise KeyError("Format not supported.")
コード例 #5
0
    def read(filename, format_='pickle'):
        """
        Reads transfer function from a 'pickle' file.

        Parameter
        ---------
        format_ : str
            the format of the file to be retrieved - accepts 'pickle'.

        Returns
        -------
        data : class instance
            `TransferFunction` object
        """
        
        object = read(filename, format_)

        if format_ == 'pickle':
            return object

        else:
            raise KeyError("Format not understood.")
コード例 #6
0
ファイル: transfer.py プロジェクト: matteobachetti/stingray
    def read(filename, format_='pickle'):
        """
        Reads transfer function from a 'pickle' file.

        Parameter
        ---------
        format\_ : str
            the format of the file to be retrieved - accepts 'pickle'.

        Returns
        -------
        data : class instance
            `TransferFunction` object
        """
        
        object = read(filename, format_)

        if format_ == 'pickle':
            return object

        else:
            raise KeyError("Format not understood.")
コード例 #7
0
ファイル: simulator.py プロジェクト: matteobachetti/stingray
    def read(filename, format_='pickle'):
        """
        Imports Simulator object.

        Parameters
        ----------
        filename : str
            Name of the Simulator object to be read.

        format_ : str
            Available option is 'pickle.'

        Returns
        -------
        object : `Simulator` object
        """

        if format_ == 'pickle':
            data = io.read(filename, 'pickle')
            return data
        else:
            raise KeyError("Format not supported.")