Beispiel #1
0
    def generate_lc(self, pointing_index, n_days, gmag, S82index,
                    random_state=None):
        gen = RRLyraeGenerated(self.S82data.ids[S82index],
                               random_state=random_state)

        pointing = self.pointings[pointing_index]
        pointing = pointing[pointing['mjd'] <= pointing['mjd'].min() + n_days]
        t = pointing['mjd']
        filts = pointing['filter']
        m5 = pointing['m5']
        
        # generate magnitudes; no errors
        mag = np.zeros_like(t)
        for i, filt in enumerate('ugrizy'):
            mask = (filts == i)
            # HACK: for y-band, use z-band template
            if filt == 'y': filt = 'z'
            mag[mask] = gen.generated(filt, t[mask])

        # adjust mags to desired r-band mean
        gmag_mean = mag[filts == 1].mean()
        mag += (gmag - gmag_mean)

        # compute magnitude error from m5 (eq 5 of Ivezic 2014 LSST paper)
        gamma = np.array([0.037, 0.038, 0.039, 0.039, 0.040, 0.040])
        x = 10 ** (0.4 * (mag - m5))
        sig2_rand = (0.04 - gamma[filts]) * x + gamma[filts] * x ** 2
        sig2_sys = 0.005 ** 2
        dmag = np.sqrt(sig2_sys + sig2_rand)

        rng = np.random.RandomState(random_state)
        mag += dmag * rng.randn(len(mag))

        return t, mag, dmag, filts
Beispiel #2
0
    def generate_lc(self,
                    pointing_index,
                    n_days,
                    gmag,
                    S82index,
                    random_state=None):
        gen = RRLyraeGenerated(self.S82data.ids[S82index],
                               random_state=random_state)

        pointing = self.pointings[pointing_index]
        pointing = pointing[pointing['mjd'] <= pointing['mjd'].min() + n_days]
        t = pointing['mjd']
        filts = pointing['filter']
        m5 = pointing['m5']

        # generate magnitudes; no errors
        mag = np.zeros_like(t)
        for i, filt in enumerate('ugrizy'):
            mask = (filts == i)
            # HACK: for y-band, use z-band template
            if filt == 'y': filt = 'z'
            mag[mask] = gen.generated(filt, t[mask])

        # adjust mags to desired r-band mean
        gmag_mean = mag[filts == 1].mean()
        mag += (gmag - gmag_mean)

        # compute magnitude error from m5 (eq 5 of Ivezic 2014 LSST paper)
        gamma = np.array([0.037, 0.038, 0.039, 0.039, 0.040, 0.040])
        x = 10**(0.4 * (mag - m5))
        sig2_rand = (0.04 - gamma[filts]) * x + gamma[filts] * x**2
        sig2_sys = 0.005**2
        dmag = np.sqrt(sig2_sys + sig2_rand)

        rng = np.random.RandomState(random_state)
        mag += dmag * rng.randn(len(mag))

        return t, mag, dmag, filts
Beispiel #3
0
band separately, and taking a majority vote between the bands.
"""
import numpy as np
import matplotlib.pyplot as plt

# Use seaborn settings for plot styles
import seaborn
seaborn.set()

from gatspy.datasets import RRLyraeGenerated
from gatspy.periodic import (LombScargleAstroML, LombScargleMultiband,
                             NaiveMultiband)

# Choose a Sesar 2010 object to base our fits on
lcid = 1019544
rrlyrae = RRLyraeGenerated(lcid, random_state=0)
print("Extinction A_r = {0:.4f}".format(rrlyrae.obsmeta['rExt']))

# Generate data in a 6-month observing season
Nobs = 60
rng = np.random.RandomState(0)

nights = np.arange(180)
rng.shuffle(nights)
nights = nights[:Nobs]

# Find a subset of the simulated data. This is the same procedure as in
# fig_multiband_sim
t = 57000 + nights + 0.05 * rng.randn(Nobs)
dy = 0.06 + 0.01 * rng.randn(Nobs)
mags = np.array(
import os
sys.path.append(os.path.abspath('../..'))

import numpy as np
import matplotlib.pyplot as plt

# Use seaborn settings for plot styles
import seaborn; seaborn.set()

from gatspy.datasets import RRLyraeGenerated
from gatspy.periodic import LombScargle


# Choose a Sesar 2010 object to base our fits on
lcid = 1019544
rrlyrae = RRLyraeGenerated(lcid, random_state=0)

# Generate data in a 6-month observing season
Nobs = 60
rng = np.random.RandomState(0)

nights = np.arange(180)
rng.shuffle(nights)
nights = nights[:Nobs]

t = 57000 + nights + 0.05 * rng.randn(Nobs)
dmag = 0.06 + 0.01 * rng.randn(Nobs)
mag = rrlyrae.generated('r', t, err=dmag, corrected=False)

periods = np.linspace(0.2, 1.4, 1000)
Beispiel #5
0
import os
sys.path.append(os.path.abspath('../..'))

import numpy as np
import matplotlib.pyplot as plt

# Use seaborn settings for plot styles
import seaborn
seaborn.set()

from gatspy.datasets import RRLyraeGenerated
from gatspy.periodic import LombScargle

# Choose a Sesar 2010 object to base our fits on
lcid = 1019544
rrlyrae = RRLyraeGenerated(lcid, random_state=0)

# Generate data in a 6-month observing season
Nobs = 60
rng = np.random.RandomState(0)

nights = np.arange(180)
rng.shuffle(nights)
nights = nights[:Nobs]

t = 57000 + nights + 0.1 * rng.randn(Nobs)
dmag = 0.06 + 0.01 * rng.randn(Nobs)
mag = (16 + 0.5 * np.sin(2 * np.pi * t / rrlyrae.period - 0.4) +
       dmag * rng.randn(Nobs))
phase = (t / rrlyrae.period) % 1
band separately, and taking a majority vote between the bands.
"""
import numpy as np
import matplotlib.pyplot as plt

# Use seaborn settings for plot styles
import seaborn; seaborn.set()

from gatspy.datasets import RRLyraeGenerated
from gatspy.periodic import (LombScargleAstroML, LombScargleMultiband,
                             NaiveMultiband)


# Choose a Sesar 2010 object to base our fits on
lcid = 1019544
rrlyrae = RRLyraeGenerated(lcid, random_state=0)
print("Extinction A_r = {0:.4f}".format(rrlyrae.obsmeta['rExt']))

# Generate data in a 6-month observing season
Nobs = 60
rng = np.random.RandomState(0)

nights = np.arange(180)
rng.shuffle(nights)
nights = nights[:Nobs]

# Find a subset of the simulated data. This is the same procedure as in
# fig_multiband_sim
t = 57000 + nights + 0.05 * rng.randn(Nobs)
dy = 0.06 + 0.01 * rng.randn(Nobs)
mags = np.array([rrlyrae.generated(band, t, err=dy, corrected=False)
Beispiel #7
0
import os
sys.path.append(os.path.abspath('../..'))

import numpy as np
import matplotlib.pyplot as plt

# Use seaborn settings for plot styles
import seaborn
seaborn.set()

from gatspy.datasets import RRLyraeGenerated
from gatspy.periodic import LombScargle

# Choose a Sesar 2010 object to base our fits on
lcid = 1019544
rrlyrae = RRLyraeGenerated(lcid, random_state=0)

# Generate data in a 6-month observing season
Nobs = 60
rng = np.random.RandomState(0)

nights = np.arange(180)
rng.shuffle(nights)
nights = nights[:Nobs]

t = 57000 + nights + 0.05 * rng.randn(Nobs)
dmag = 0.06 + 0.01 * rng.randn(Nobs)
mag = rrlyrae.generated('r', t, err=dmag, corrected=False)

periods = np.linspace(0.2, 1.4, 1000)
Beispiel #8
0
import numpy as np
import matplotlib.pyplot as plt

# Use seaborn settings for plot styles
import seaborn; seaborn.set()
seaborn.set_palette('deep', 5)

from gatspy.datasets import RRLyraeGenerated
from gatspy.periodic import LombScargle, LombScargleMultiband


# Choose a Sesar 2010 object to base our fits on
lcid = 1019544
rrlyrae = RRLyraeGenerated(lcid, random_state=0)
print("Extinction A_r = {0:.4f}".format(rrlyrae.obsmeta['rExt']))

# Generate data in a 6-month observing season
Nobs = 30
rng = np.random.RandomState(0)

nights = np.arange(6 * Nobs)
rng.shuffle(nights)
nights = nights[:Nobs]

t = 57000 + nights + 0.05 * rng.randn(Nobs)
dy = 0.06 + 0.01 * rng.randn(Nobs)
mags = np.array([rrlyrae.generated(band, t, err=dy, corrected=False)
                 for band in 'ugriz'])
filts = np.array([f for f in 'ugriz'])