예제 #1
0
    def simulate(self, *args):
        """
        Simulate light curve generation using power spectrum or
        impulse response.

        Examples
        --------
        * x = simulate(beta):
           For generating a light curve using power law spectrum.

              Parameters:
                * beta : float
                  Defines the shape of spectrum

        * x = simulate(s):
           For generating a light curve from user-provided spectrum.
            **Note**: In this case, the `red_noise` parameter is provided.
            You can generate a longer light curve by providing a higher
            frequency resolution on the input power spectrum.

              Parameters:
                * s : array-like
                  power spectrum

        * x = simulate(model):
           For generating a light curve from pre-defined model

              Parameters:
                * model : astropy.modeling.Model
                  the pre-defined model

        * x = simulate('model', params):
           For generating a light curve from pre-defined model

              Parameters:
                * model : string
                  the pre-defined model
                * params : list iterable or dict
                  the parameters for the pre-defined model

        * x = simulate(s, h):
           For generating a light curve using impulse response.

              Parameters:
                * s : array-like
                  Underlying variability signal
                * h : array-like
                  Impulse response

        * x = simulate(s, h, 'same'):
           For generating a light curve of same length as input signal,
           using impulse response.

              Parameters:
                * s : array-like
                  Underlying variability signal
                * h : array-like
                  Impulse response
                * mode : str
                  mode can be 'same', 'filtered, or 'full'.
                  'same' indicates that the length of output light
                  curve is same as that of input signal.
                  'filtered' means that length of output light curve
                  is len(s) - lag_delay
                  'full' indicates that the length of output light
                  curve is len(s) + len(h) -1

        Parameters
        ----------
        args
            See examples below.

        Returns
        -------
        lightCurve : `LightCurve` object

        """
        if isinstance(args[0], (numbers.Integral, float)) and len(args) == 1:
            return self._simulate_power_law(args[0])

        elif isinstance(args[0], astropy.modeling.Model) and len(args) == 1:
            return self._simulate_model(args[0])

        elif utils.is_string(args[0]) and len(args) == 2:
            return self._simulate_model_string(args[0], args[1])

        elif len(args) == 1:
            return self._simulate_power_spectrum(args[0])

        elif len(args) == 2:
            return self._simulate_impulse_response(args[0], args[1])

        elif len(args) == 3:
            return self._simulate_impulse_response(args[0], args[1], args[2])

        else:
            raise ValueError("Length of arguments must be 1, 2 or 3.")
예제 #2
0
    def simulate(self, *args):
        """
        Simulate light curve generation using power spectrum or
        impulse response.

        Examples
        --------
        * x = simulate(beta):
           For generating a light curve using power law spectrum.

              Parameters:
                * beta : float
                  Defines the shape of spectrum

        * x = simulate(s):
           For generating a light curve from user-provided spectrum.

              Parameters:
                * s : array-like
                  power spectrum

        * x = simulate(model):
           For generating a light curve from pre-defined model

              Parameters:
                * model : astropy.modeling.Model
                  the pre-defined model

        * x = simulate('model', params):
           For generating a light curve from pre-defined model

              Parameters:
                * model : string
                  the pre-defined model
                * params : list iterable or dict
                  the parameters for the pre-defined model

        * x = simulate(s, h):
           For generating a light curve using impulse response.

              Parameters:
                * s : array-like
                  Underlying variability signal
                * h : array-like
                  Impulse response

        * x = simulate(s, h, 'same'):
           For generating a light curve of same length as input signal,
           using impulse response.

              Parameters:
                * s : array-like
                  Underlying variability signal
                * h : array-like
                  Impulse response
                * mode : str
                  mode can be 'same', 'filtered, or 'full'.
                  'same' indicates that the length of output light
                  curve is same as that of input signal.
                  'filtered' means that length of output light curve
                  is len(s) - lag_delay
                  'full' indicates that the length of output light
                  curve is len(s) + len(h) -1

        Parameters
        ----------
        args
            See examples below.

        Returns
        -------
        lightCurve : `LightCurve` object

        """

        if isinstance(args[0], (numbers.Integral, float)) and len(args) == 1:
            return  self._simulate_power_law(args[0])

        elif isinstance(args[0], astropy.modeling.Model) and len(args) == 1:
            return self._simulate_model(args[0])

        elif utils.is_string(args[0]) and len(args) == 2:
            return self._simulate_model_string(args[0], args[1])

        elif len(args) == 1:
            return self._simulate_power_spectrum(args[0])

        elif len(args) == 2:
            return self._simulate_impulse_response(args[0], args[1])

        elif len(args) == 3:
            return self._simulate_impulse_response(args[0], args[1], args[2])

        else:
            raise ValueError("Length of arguments must be 1, 2 or 3.")
예제 #3
0
    def simulate(self, *args):
        """
        Simulate light curve generation using power spectrum or
        impulse response.

        Examples
        --------
        - x = simulate(2)
            For generating a light curve using power law spectrum.

            Parameters
            ----------
            Beta: int
                Defines the shape of spectrum
            N: int
                Number of samples

            Returns
            -------
            lightCurve: `LightCurve` object
        
        - x = simulate(s)
            For generating a light curve from user-provided spectrum.

            Parameters
            ----------
            s: array-like
                power spectrum

            Returns
            -------
            lightCurve: `LightCurve` object

        - x = simulate('lorenzian', p)
            For generating a light curve from pre-defined model

            Parameters
            ----------
            model: str
                name of the pre-defined model

            p: list iterable
                model parameters. For details, see model definitions
                in model.py

            Returns
            -------
            lightCurve: `LightCurve` object

        - x = simulate(s, h)
            For generating a light curve using impulse response.

            Parameters
            ----------
            s: array-like
                Underlying variability signal
            h: array-like
                Impulse response

            Returns
            -------
            lightCurve: `LightCurve` object

        - x = simulate(s, h, 'same')
            For generating a light curve of same length as input
            signal, using impulse response.

            Parameters
            ----------
            s: array-like
                Underlying variability signal
            h: array-like
                Impulse response
            mode: str
                mode can be 'same', 'filtered, or 'full'.
                'same' indicates that the length of output light
                curve is same as that of input signal.
                'filtered' means that length of output light curve
                is len(s) - lag_delay
                'full' indicates that the length of output light
                curve is len(s) + len(h) -1

        Returns
            -------
            lightCurve: `LightCurve` object
        """

        if isinstance(args[0], numbers.Integral) and len(args) == 1:
            return self._simulate_power_law(args[0])

        elif len(args) == 1:
            return self._simulate_power_spectrum(args[0])

        elif utils.is_string(args[0]) and len(args) == 2:
            return self._simulate_model(args[0], args[1])

        elif len(args) == 2:
            return self._simulate_impulse_response(args[0], args[1])

        elif len(args) == 3:
            return self._simulate_impulse_response(args[0], args[1], args[2])

        else:
            raise ValueError("Length of arguments must be 1, 2 or 3.")
예제 #4
0
    def simulate(self, *args):
        """
        Simulate light curve generation using power spectrum or
        impulse response.

        Examples
        --------
        - x = simulate(2)
            For generating a light curve using power law spectrum.

            Parameters
            ----------
            Beta: int
                Defines the shape of spectrum
            N: int
                Number of samples

            Returns
            -------
            lightCurve: `LightCurve` object
        
        - x = simulate(s)
            For generating a light curve from user-provided spectrum.

            Parameters
            ----------
            s: array-like
                power spectrum

            Returns
            -------
            lightCurve: `LightCurve` object

        - x = simulate('lorenzian', p)
            For generating a light curve from pre-defined model

            Parameters
            ----------
            model: str
                name of the pre-defined model

            p: list iterable
                model parameters. For details, see model definitions
                in model.py

            Returns
            -------
            lightCurve: `LightCurve` object

        - x = simulate(s, h)
            For generating a light curve using impulse response.

            Parameters
            ----------
            s: array-like
                Underlying variability signal
            h: array-like
                Impulse response

            Returns
            -------
            lightCurve: `LightCurve` object

        - x = simulate(s, h, 'same')
            For generating a light curve of same length as input
            signal, using impulse response.

            Parameters
            ----------
            s: array-like
                Underlying variability signal
            h: array-like
                Impulse response
            mode: str
                mode can be 'same', 'filtered, or 'full'.
                'same' indicates that the length of output light
                curve is same as that of input signal.
                'filtered' means that length of output light curve
                is len(s) - lag_delay
                'full' indicates that the length of output light
                curve is len(s) + len(h) -1

        Returns
            -------
            lightCurve: `LightCurve` object
        """

        if isinstance(args[0], numbers.Integral) and len(args) == 1: 
            return  self._simulate_power_law(args[0])

        elif len(args) == 1:
            return self._simulate_power_spectrum(args[0])

        elif utils.is_string(args[0]) and len(args) == 2:
            return self._simulate_model(args[0], args[1])

        elif len(args) == 2:
            return self._simulate_impulse_response(args[0], args[1])

        elif len(args) == 3:
            return self._simulate_impulse_response(args[0], args[1], args[2])

        else:
            raise ValueError("Length of arguments must be 1, 2 or 3.")