Exemplo n.º 1
0
def test_simulate_lightcurve_flux():
    event = mock.MagicMock()
    telescope = mock.MagicMock()
    telescope.name = 'NDG'
    telescope.lightcurve_flux = np.array([[0, 51, 69], [2, 42, 28.65]])
    event.telescopes = []
    event.telescopes.append(telescope)

    model = microlsimulator.simulate_a_microlensing_model(event)
    parameters = microlsimulator.simulate_microlensing_model_parameters(model)

    fake_flux_parameters = microlsimulator.simulate_fluxes_parameters(
        event.telescopes)

    pyLIMA_parameters = model.compute_pyLIMA_parameters(parameters +
                                                        fake_flux_parameters)

    microlsimulator.simulate_lightcurve_flux(model, pyLIMA_parameters, 'No')

    assert np.all(telescope.lightcurve_flux[:, 1] != [51, 42])
    assert np.all(telescope.lightcurve_flux[:, 2] != [69, 28.65])

    microlsimulator.simulate_lightcurve_flux(model, pyLIMA_parameters, 'Yes')

    assert np.all(telescope.lightcurve_flux[:, 1] != [51, 42])
    assert np.all(telescope.lightcurve_flux[:, 2] != [69, 28.65])
Exemplo n.º 2
0
def test_simulate_lightcurve_flux():
    event = mock.MagicMock()
    telescope = mock.MagicMock()
    telescope.name = 'NDG'
    telescope.lightcurve_flux = np.array([[0, 51, 69], [2, 42, 28.65]])
    event.telescopes = []
    event.telescopes.append(telescope)

    model = microlsimulator.simulate_a_microlensing_model(event)
    parameters = microlsimulator.simulate_microlensing_model_parameters(model)

    fake_flux_parameters = microlsimulator.simulate_fluxes_parameters(event.telescopes)

    pyLIMA_parameters = model.compute_pyLIMA_parameters(parameters + fake_flux_parameters)

    microlsimulator.simulate_lightcurve_flux(model, pyLIMA_parameters, 'No')

    assert np.all(telescope.lightcurve_flux[:, 1] != [51, 42])
    assert np.all(telescope.lightcurve_flux[:, 2] != [69, 28.65])

    microlsimulator.simulate_lightcurve_flux(model, pyLIMA_parameters, 'Yes')

    assert np.all(telescope.lightcurve_flux[:, 1] != [51, 42])
    assert np.all(telescope.lightcurve_flux[:, 2] != [69, 28.65])
Exemplo n.º 3
0
# [magnitude_source_SAAO_V, blending ratio_SAAO_V]], i.e [[18.5,0.3],[19.5,1.2],[20.2,1.6]] (example).

my_own_flux_parameters = microlsimulator.simulate_fluxes_parameters(
    my_own_creation.telescopes)
my_own_parameters += my_own_flux_parameters

#Now we need to transform these parameters into a parameter class object (this is a "technical" part but the interested reader can found the function here  [pyLIMA #documentation](file/../../doc/build/html/pyLIMA.microlmodels.html))

# Transform into pyLIMA standards
pyLIMA_parameters = my_own_model.compute_pyLIMA_parameters(my_own_parameters)

#Ok now we have the model we want to simulate, we then need to updates our telescopes observations!

# update the telescopes lightcurve in your event :
microlsimulator.simulate_lightcurve_flux(my_own_model,
                                         pyLIMA_parameters,
                                         red_noise_apply='Yes')

#### Plot it!

for telescope in my_own_creation.telescopes:
    plt.errorbar(telescope.lightcurve_magnitude[:, 0] - 2450000,
                 telescope.lightcurve_magnitude[:, 1],
                 yerr=telescope.lightcurve_magnitude[:, 2],
                 fmt='.',
                 label=telescope.name)

# A list of commentary to explain parameters. Of couse, this is valable only for the DSPL models.
parameter_commentary = [
    'time of minimum impact parameter for source 1',
    'minimum impact parameter for source 1',