Skip to content

Commit

Permalink
Merge pull request #45 from ebachelet/AddEN
Browse files Browse the repository at this point in the history
Add EN cross
  • Loading branch information
ebachelet committed Dec 3, 2020
2 parents 6202d19 + b21a6a4 commit d42f9e6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 2 deletions.
16 changes: 14 additions & 2 deletions docs/source/Conventions.rst
Expand Up @@ -3,8 +3,6 @@
Conventions
===========

pyLIMA uses the following conventions:

The time given in observations is expected to be in HJD.

Following the idea of uniform notations in the field, pyLIMA is based on `Gould2000 <http://adsabs.harvard.edu/abs/2000ApJ...542..785G/>`_.
Expand All @@ -28,3 +26,17 @@ Then, the source trajectory x,y is define as :
- :math:`x = \tau . cos(\alpha)- u_o . sin(\alpha)`
- :math:`y = \tau . sin(\alpha)+ u_o . cos(\alpha)`


In case the parallax is used, the angle :math:`\beta` between the East components and the trajectory at t0par is ( `Gould2004 <https://iopscience.iop.org/article/10.1086/382782>`_):

- :math:`\beta = arctan(\pi_{EN}/\pi_{EE})`

:math:`\beta` is accessible with:

.. code-block:: python
piEN = 0.8
piEE = -0.5
beta = pyLIMA.microlparallax.EN_trajectory_angle(piEN,piEE)
print(beta) #2.12939564...
31 changes: 31 additions & 0 deletions pyLIMA/microloutputs.py
Expand Up @@ -38,6 +38,7 @@
from pyLIMA import microltoolbox
from pyLIMA import microlstats
from pyLIMA import microlcaustics
from pyLIMA import microlparallax

plot_lightcurve_windows = 0.2
plot_residuals_windows = 0.21
Expand Down Expand Up @@ -1309,6 +1310,36 @@ def plot_geometry(fit):
color=plt.rcParams["axes.prop_cycle"].by_key()["color"][telescope_index],
radius_dimension = 'max',fill_alpha=0.5)

if fit.model.parallax_model[0] != 'None':

piEN = pyLIMA_parameters.piEN
piEE = pyLIMA_parameters.piEE

EN_trajectory_angle = microlparallax.EN_trajectory_angle(piEN,piEE)

plot_angle = np.pi+EN_trajectory_angle

east = [-0.1,0]
north = [0,0.1]


rota_mat = np.array([[np.cos(plot_angle),-np.sin(plot_angle)],[np.sin(plot_angle),np.cos(plot_angle)]])
east = np.dot(rota_mat,east)
north = np.dot(rota_mat,north)

figure_axes.plot([0.8,0.8+east[0]],[0.8,0.8+east[1]],'k', transform=plt.gca().transAxes)
Ecoords = [-0.125,0]
Ecoords = np.dot(rota_mat,Ecoords)
figure_axes.text(0.8+Ecoords[0],0.8+Ecoords[1],'E',c='k',transform=plt.gca().transAxes)


figure_axes.plot([0.8,0.8+north[0]],[0.8,0.8+north[1]],'k', transform=plt.gca().transAxes)
Ncoords = [0,0.125]
Ncoords = np.dot(rota_mat,Ncoords)
figure_axes.text(0.8+Ncoords[0],0.8+Ncoords[1],'N',c='k',transform=plt.gca().transAxes)



legend = figure_axes.legend(numpoints=1, loc='best', fancybox=True, framealpha=0.5)
for handle in legend.legendHandles:
try:
Expand Down
14 changes: 14 additions & 0 deletions pyLIMA/microlparallax.py
Expand Up @@ -24,6 +24,20 @@
# MAX_WINDOW_WIDTH = 80 # Max Value: 65535
# MAX_WINDOW_HEIGHT = 65535 # Max Value: 65535

def EN_trajectory_angle(piEN,piEE):
"""Finf the angle between the East vector and the source trajectory (at t0par)
:param float piEN: the North parallax component
:param float piEE: the East parallax component
:return: the angle in radians
:rtype: float
"""

angle = np.arctan2(piEN,piEE)

return angle

def horizons_obscodes(observatory):
"""Transform observatory names to JPL horizon codes.
Write by Tim Lister, thanks :)
Expand Down

0 comments on commit d42f9e6

Please sign in to comment.