# Path: pyLIMA/microlparallax.py
# TIMEOUT_JPL = 120  # seconds. The time you allow telnetlib to discuss with JPL, see space_parallax.
# JPL_TYPICAL_REQUEST_TIME_PER_LINE = 0.002  # seconds.
#     JPL_HORIZONS_ID = {
#         'Geocentric': '500',
#         'Kepler': '-227',
#         'Spitzer': '-79',
#         'HST': '-48',
#         'Gaia': '-139479',
#         'New Horizons': '-98'
#     }
#         OBSERVATORY_ID = observatory
#         OBSERVATORY_ID = JPL_HORIZONS_ID.get(observatory, 'V37')
#         AU = self.AU
#         JD = time_to_transform + np.array(time_correction)
#         X = satellite_positions[:, 1].astype(float)
#         Y = satellite_positions[:, 2].astype(float)
#         Z = satellite_positions[:, 3].astype(float)
#     OBSERVATORY_ID = horizons_obscodes(observatory)
# def EN_trajectory_angle(piEN,piEE):
# def horizons_obscodes(observatory):
# def optcallback(socket, command, option):
# def compute_parallax_curvature(piE, delta_positions):
#     def __init__(self, event, parallax_model):
#     def North_East_vectors_target(self):
#     def HJD_to_JD(self, time_to_transform):
#     def parallax_combination(self, telescope):
#     def annual_parallax(self, time_to_treat):
#     def terrestrial_parallax(self, time_to_treat, altitude, longitude, latitude):
#     def space_parallax(self, time_to_treat, satellite_name, telescope):
#     def lonely_satellite(self, time_to_treat, telescope):
# def produce_horizons_ephem(body, start_time, end_time, observatory='ELP', step_size='60m',
#                            verbose=False):
# class MLParallaxes(object):


from astropy.time import Time
from astropy.coordinates import solar_system_ephemeris, EarthLocation
from astropy.coordinates import get_body_barycentric, get_body, get_moon
from pyLIMA import microlparallax
import numpy as np
import unittest.mock as mock
    event.telescopes[0].name = 'Test'
    event.telescopes[0].lightcurve_flux = np.array([[0, 1, 1], [42, 6, 6]])
    event.telescopes[0].filter = 'I'
    event.telescopes[0].gamma = 0.5
    event.ra = 180
    event.dec = 360
    return event


def test_create_parallax():

    event = _create_event()
    parallax_model = ['None', 1664.51]
    parallax = microlparallax.MLParallaxes(event, parallax_model)

    assert parallax.parallax_model == 'None'
    assert parallax.to_par == 1664.51
    np.allclose(parallax.AU ,  149597870700)
    np.allclose(parallax.speed_of_light ,  299792458)
    np.allclose(parallax.Earth_radius ,  6378137000)


    np.allclose(parallax.target_angles_in_the_sky, [np.pi , 2* np.pi ])
    np.allclose(parallax.North, [0 , 1, 0 ])
    np.allclose(parallax.East, [0 , 0, 1])

def test_HJD_to_JD():

    event = _create_event()
    parallax_model = ['None', 1664.51]

# Path: pyLIMA/microlparallax.py
# TIMEOUT_JPL = 120  # seconds. The time you allow telnetlib to discuss with JPL, see space_parallax.
# JPL_TYPICAL_REQUEST_TIME_PER_LINE = 0.002  # seconds.
#     JPL_HORIZONS_ID = {
#         'Geocentric': '500',
#         'Kepler': '-227',
#         'Spitzer': '-79',
#         'HST': '-48',
#         'Gaia': '-139479',
#         'New Horizons': '-98'
#     }
#         OBSERVATORY_ID = observatory
#         OBSERVATORY_ID = JPL_HORIZONS_ID.get(observatory, 'V37')
#         AU = self.AU
#         JD = time_to_transform + np.array(time_correction)
#         X = satellite_positions[:, 1].astype(float)
#         Y = satellite_positions[:, 2].astype(float)
#         Z = satellite_positions[:, 3].astype(float)
#     OBSERVATORY_ID = horizons_obscodes(observatory)
# def EN_trajectory_angle(piEN,piEE):
# def horizons_obscodes(observatory):
# def optcallback(socket, command, option):
# def compute_parallax_curvature(piE, delta_positions):
#     def __init__(self, event, parallax_model):
#     def North_East_vectors_target(self):
#     def HJD_to_JD(self, time_to_transform):
#     def parallax_combination(self, telescope):
#     def annual_parallax(self, time_to_treat):
#     def terrestrial_parallax(self, time_to_treat, altitude, longitude, latitude):
#     def space_parallax(self, time_to_treat, satellite_name, telescope):
#     def lonely_satellite(self, time_to_treat, telescope):
# def produce_horizons_ephem(body, start_time, end_time, observatory='ELP', step_size='60m',
#                            verbose=False):
# class MLParallaxes(object):


# Path: pyLIMA/test/test_microlparallax.py
from astropy.time import Time
from astropy.coordinates import solar_system_ephemeris, EarthLocation
from astropy.coordinates import get_body_barycentric, get_body, get_moon
from pyLIMA import microlparallax
import numpy as np
import unittest.mock as mock

    event.telescopes[0].name = 'Test'
    event.telescopes[0].lightcurve_flux = np.array([[0, 1, 1], [42, 6, 6]])
    event.telescopes[0].filter = 'I'
    event.telescopes[0].gamma = 0.5
    event.ra = 180
    event.dec = 360
    return event


def test_create_parallax():

    event = _create_event()
    parallax_model = ['None', 1664.51]
    parallax = microlparallax.MLParallaxes(event, parallax_model)

    assert parallax.parallax_model == 'None'
    assert parallax.to_par == 1664.51
    np.allclose(parallax.AU ,  149597870700)
    np.allclose(parallax.speed_of_light ,  299792458)
    np.allclose(parallax.Earth_radius ,  6378137000)


    np.allclose(parallax.target_angles_in_the_sky, [np.pi , 2* np.pi ])
    np.allclose(parallax.North, [0 , 1, 0 ])
    np.allclose(parallax.East, [0 , 0, 1])

def test_HJD_to_JD():

    event = _create_event()
    parallax_model = ['None', 1664.51]

    parallax = microlparallax.MLParallaxes(event, parallax_model)