# 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




def test_poisson_noise():
    flux = np.array([150, 10 ** 5.2, 0.1])
    error = flux ** 0.5

# 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





def test_poisson_noise():
    flux = np.array([150, 10 ** 5.2, 0.1])
    error = flux ** 0.5

    assert np.allclose(microlsimulator.poisson_noise(flux), error)