示例#1
0
def test_simulate_a_telescope():
    event = mock.MagicMock()
    telescope = microlsimulator.simulate_a_telescope('blabli', 51, 51, 51, 'orange', 0, 42, 1.0, event, 'Space')

    assert len(telescope.lightcurve_flux[:, 0]) == 42*24

    event.ra = 270
    event.dec = -30

    telescope = microlsimulator.simulate_a_telescope('blabli', 0, 0, -30, 'orange', 2457850, 2457900, 1.0, event,
                                                     'Earth',0,0,0,100)

    histogram, windows = np.histogram(telescope.lightcurve_flux[:,0],np.arange(2457850,2457900))
    assert len(telescope.lightcurve_flux[:, 0]) == 461.0
    assert histogram[0]<histogram[-1]
示例#2
0
def test_simulate_a_telescope():
    event = mock.MagicMock()
    telescope = microlsimulator.simulate_a_telescope('blabli', 51, 51, 51,
                                                     'orange', 0, 42, 1.0,
                                                     event, 'Space')

    assert len(telescope.lightcurve_flux[:, 0]) == 42 * 24

    event.ra = 270
    event.dec = -30

    telescope = microlsimulator.simulate_a_telescope('blabli', 0, 0, -30,
                                                     'orange', 2457850,
                                                     2457900, 1.0, event,
                                                     'Earth', 0, 0, 0, 100)

    histogram, windows = np.histogram(telescope.lightcurve_flux[:, 0],
                                      np.arange(2457850, 2457900))
    assert len(telescope.lightcurve_flux[:, 0]) == 461.0
    assert histogram[0] < histogram[-1]
示例#3
0
def test_simulate_a_telescope():
    event = mock.MagicMock()
    telescope = microlsimulator.simulate_a_telescope('blabli', event, 0,42,1, 'Space',
                                                     'orange', altitude = 51, longitude = 51, latitude=51)

    assert len(telescope.lightcurve_flux[:, 0]) == 42*24

    event.ra = 270
    event.dec = -30

    telescope = microlsimulator.simulate_a_telescope('blabli', event,2457850,2457900,1, 'Earth',
                                                     'orange', altitude = 0, longitude = 0, latitude=-30,
                                                     bad_weather_percentage=0.0,
                                                     minimum_alt=0, moon_windows_avoidance=0,
                                                     maximum_moon_illumination=100.0
                                                     )
    
    histogram, windows = np.histogram(telescope.lightcurve_flux[:,0],np.arange(2457850,2457900))

    assert len(telescope.lightcurve_flux[:, 0]) == 461.0
    assert histogram[0]<histogram[-1]
示例#4
0
#We need to build telescopes before the model that we gonna simulate because models need informations about filters and how many telescopes did observe your simulation.

# Create some telescopes

# Name = survey,your_event, location = 'Earth', start_obs =2457465.500000, end_obs = 2457665.500000,
# sampling(hours) = 4, location='Earth', uniform_sampling=False, filter = 'I', altitude = 1000 m, longitude = -109.285399,
# latitude = -27.130814, bad_weather_percentage = 10%, moon_windows_avoidance (degree)=30,
# minimum_alt=30)
my_survey = microlsimulator.simulate_a_telescope('survey',
                                                 my_own_creation,
                                                 2457365.500000,
                                                 2457965.500000,
                                                 4,
                                                 'Earth',
                                                 'I',
                                                 uniform_sampling=False,
                                                 altitude=1000,
                                                 longitude=-109.285399,
                                                 latitude=-27.130,
                                                 bad_weather_percentage=10.0 /
                                                 100,
                                                 moon_windows_avoidance=30,
                                                 minimum_alt=30)

# Name = SAAO_I,your_event, location = 'Earth', start_obs =2457585.5, end_obs = 2457615.5,
# sampling(hours) = 2, location='Earth', uniform_sampling=False, filter = 'I', altitude = 400 m, longitude = 20.659279,
# latitude = -32.3959, bad_weather_percentage = 20%, mmoon_windows_avoidance (degree)=15,
# minimum_alt=15)
my_own_telescope_1 = microlsimulator.simulate_a_telescope(
    'SAAO_I',
    my_own_creation,
示例#5
0
my_own_creation = microlsimulator.simulate_a_microlensing_event(name ='A spectacular double source point lens', 
                                                                ra=270, dec=-30)


#Create some telescopes. This function create a telescope class, more details here [pyLIMA documentation](file/../../doc/build/html/pyLIMA.telescopes.html)
#You need to create a telescope class for each filter with a different name. For example here, SAAO_I and SAAO_V.
#We need to build telescopes before the model that we gonna simulate because models need informations about filters and how many telescopes did observe your simulation.

### Create some telescopes

# Name = Survey, location = 'Earth', altitude = 1000 m, longitude = -109.285399, latitude = -27.130814,filter = 'I',start_obs =2457465.500000,
# end_obs = 2457665.500000 sampling(hours) = 4, your_event, bad_weather_percentage = 10%, mmoon_windows_avoidance (degree)=30, 
# minimum_alt=30)
my_survey = microlsimulator.simulate_a_telescope('survey',  1000, -109.285399, -27.130, 'I', 2457365.500000,2457965.500000,
                                                 4, my_own_creation, location = 'Earth',
                                                 bad_weather_percentage=10.0 / 100, moon_windows_avoidance=30, 
                                                 minimum_alt=30)


# Name = 'SAAO_I', altitude = 400 m, longitude = 20.659279, latitude = -32.3959,filter = 'I',start_obs =2457585.500000,
# end_obs = 2457615.500000, sampling(hours) = 2,  your_event,bad_weather_percentage = 20%, moon_windows_avoidance (degree)=15, 
#minimum_alt=15)
my_own_telescope_1 = microlsimulator.simulate_a_telescope('SAAO_I', 400, 20.659279, -32.3959, 'I', 2457585.5, 2457615.5, 
                                                          2,  my_own_creation, location = 'Earth', 
                                                          bad_weather_percentage=20.0 / 100, 
                                                          moon_windows_avoidance=15, minimum_alt=15)
# Name = 'SAAO_V', altitude = 400 m, longitude = 20.659279, latitude = -32.3959,filter = 'V',start_obs =2457689,
# end_obs = 2457750, sampling(hours) = 12, your_event, bad_weather_percentage = 20%, moon_windows_avoidance (degree)=20, 
# minimum_alt=15)
my_own_telescope_2 = microlsimulator.simulate_a_telescope('SAAO_V', 400, 20.659279, -32.3959, 'V', 2457585.5, 2457615.5, 
                                                          12,  my_own_creation, location = 'Earth',

ZP = 27.615

from pyLIMA import microlsimulator
from pyLIMA import microlcaustics
from pyLIMA import microlmodels

HEADER = 'Name          Type     to          uo       tE     rho      log_s   log_q   alpha   f_source  g_blending to-time_anomaly \n'

my_own_creation = microlsimulator.simulate_a_microlensing_event(
    name='A binary lens observed by WFIRST', ra=270, dec=-30)
wfirst1 = microlsimulator.simulate_a_telescope('WFIRST',
                                               my_own_creation,
                                               2459000,
                                               2459000 + 72,
                                               0.25,
                                               'Space',
                                               'W149',
                                               uniform_sampling=True)

wfirst2 = microlsimulator.simulate_a_telescope('WFIRST',
                                               my_own_creation,
                                               2459000 + 365.25,
                                               2459000 + 72 + 365.25,
                                               0.25,
                                               'Space',
                                               'W149',
                                               uniform_sampling=True)
wfirst3 = microlsimulator.simulate_a_telescope('WFIRST',
                                               my_own_creation,
                                               2459000 + 2 * 365.25,
示例#7
0
#your_event.fits[-1].produce_outputs()
#plt.show()

plt.close()

# OK let's simulate an event now

from pyLIMA import microlsimulator

my_own_creation = microlsimulator.simulate_a_microlensing_event(
    name='A spectacular double source point lens', ra=270, dec=-30)

my_survey = microlsimulator.simulate_a_telescope('survey',
                                                 my_own_creation,
                                                 2457365.500000,
                                                 2457765.500000,
                                                 48,
                                                 'Earth',
                                                 'I',
                                                 uniform_sampling=True)
my_own_creation.telescopes.append(my_survey)

my_own_model = microlsimulator.simulate_a_microlensing_model(
    my_own_creation,
    model='PSPL',
    parallax=['None', 0.0],
    xallarap=['None', 0.0],
    orbital_motion=['None', 0.0],
    source_spots='None')

my_own_parameters = [2457458, 0.56, 65]