# Path: pyLIMA/microlsimulator.py
# RED_NOISE = 'Yes'
# SOURCE_MAGNITUDE = [14, 22]
# BLEND_LIMITS = [0, 1]
# EXPOSURE_TIME = 50 #seconds
# def moon_illumination(sun, moon):
# def poisson_noise(flux):
# def noisy_observations(flux, error_flux):
# def time_simulation(time_start, time_end, sampling, bad_weather_percentage):
# def red_noise(time):
# def simulate_a_microlensing_event(name='Microlensing pyLIMA simulation', ra=270, dec=-30):
# def simulate_a_telescope(name, event, time_start, time_end, sampling, location, filter, uniform_sampling=False,
#                          altitude=0, longitude=0, latitude=0, spacecraft_name=None, bad_weather_percentage=0.0,
#                          minimum_alt=20, moon_windows_avoidance=20, maximum_moon_illumination=100.0):
# def simulate_a_microlensing_model(event, model='PSPL', args=(), parallax=['None', 0.0], xallarap=['None'],
#                                   orbital_motion=['None', 0.0], source_spots='None'):
# def simulate_microlensing_model_parameters(model):
# def simulate_fluxes_parameters(list_of_telescopes):
# def simulate_lightcurve_flux(model, pyLIMA_parameters, red_noise_apply='Yes'):


import collections
import unittest.mock as mock
import numpy as np
import pytest
from pyLIMA import microlsimulator
    parameters = microlsimulator.simulate_microlensing_model_parameters(model)

    assert parameters[2] < 100

def test_simulate_fluxes_parameters():
    telescope = mock.MagicMock()
    telescopes = [telescope]

    fake_flux_parameters = microlsimulator.simulate_fluxes_parameters(telescopes)

    assert len(fake_flux_parameters) == 2

    assert fake_flux_parameters[0] > 10 ** ((27.4 - 22) / 2.5)
    assert fake_flux_parameters[0] < 10 ** ((27.4 - 14) / 2.5)

    assert fake_flux_parameters[1] < 1
    assert fake_flux_parameters[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)


# Path: pyLIMA/microlsimulator.py
# RED_NOISE = 'Yes'
# SOURCE_MAGNITUDE = [14, 22]
# BLEND_LIMITS = [0, 1]
# EXPOSURE_TIME = 50 #seconds
# def moon_illumination(sun, moon):
# def poisson_noise(flux):
# def noisy_observations(flux, error_flux):
# def time_simulation(time_start, time_end, sampling, bad_weather_percentage):
# def red_noise(time):
# def simulate_a_microlensing_event(name='Microlensing pyLIMA simulation', ra=270, dec=-30):
# def simulate_a_telescope(name, event, time_start, time_end, sampling, location, filter, uniform_sampling=False,
#                          altitude=0, longitude=0, latitude=0, spacecraft_name=None, bad_weather_percentage=0.0,
#                          minimum_alt=20, moon_windows_avoidance=20, maximum_moon_illumination=100.0):
# def simulate_a_microlensing_model(event, model='PSPL', args=(), parallax=['None', 0.0], xallarap=['None'],
#                                   orbital_motion=['None', 0.0], source_spots='None'):
# def simulate_microlensing_model_parameters(model):
# def simulate_fluxes_parameters(list_of_telescopes):
# def simulate_lightcurve_flux(model, pyLIMA_parameters, red_noise_apply='Yes'):


# Path: pyLIMA/test/test_microlsimulator.py
import collections
import unittest.mock as mock
import numpy as np
import pytest
from pyLIMA import microlsimulator

    parameters = microlsimulator.simulate_microlensing_model_parameters(model)

    assert parameters[2] < 100

def test_simulate_fluxes_parameters():
    telescope = mock.MagicMock()
    telescopes = [telescope]

    fake_flux_parameters = microlsimulator.simulate_fluxes_parameters(telescopes)

    assert len(fake_flux_parameters) == 2

    assert fake_flux_parameters[0] > 10 ** ((27.4 - 22) / 2.5)
    assert fake_flux_parameters[0] < 10 ** ((27.4 - 14) / 2.5)

    assert fake_flux_parameters[1] < 1
    assert fake_flux_parameters[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)