GENERAL USE AND SHARED FUNCTIONS

Shared Functions

model.u0_hat_from_thetaE_hat(thetaE_hat, beta)

Calculate the closest approach vector direction. Define the beta sign convention as Andy Gould does with

  • beta > 0 means u0_E > 0

  • u0_amp > 0 mean u0_E > 0

See Gould 2004, pg 320, bottom right

u0 > 0 –> lens passes to the right side of the source as seen from Earth

\(thetaX0 = xS0 - xL0 = u0 * thetaE\)

which implies that:

  • u0_E > 0 for u0 > 0

  • u0_E < 0 for u0 < 0

which is what we use.

model.parallax_in_direction(RA, Dec, mjd)

Memoized version of parallax_in_direction(RA, Dec, mjd)

R.A. in degrees. (J2000)
Dec. in degrees. (J2000)
MJD

Equations following MulensModel.

model.dparallax_dt_in_direction(RA, Dec, mjd)

R.A. in degrees. (J2000) Dec. in degrees. (J2000) MJD

Equations following MulensModel. Time derivative –> units are yr^-1

model.sun_position(mjd, radians=False)
NAME:

SUNPOS

PURPOSE:

To compute the RA and Dec of the Sun at a given date.

INPUTS:

mjd - The modified Julian date of the day (and time), scalar or vector

OUTPUTS:
ra:
The right ascension of the sun at that date in DEGREES
double precision, same number of elements as jd
dec:

The declination of the sun at that date in DEGREES

elong:

Ecliptic longitude of the sun at that date in DEGREES.

obliquity:

the obliquity of the ecliptic, in DEGREES

OPTIONAL INPUT KEYWORD:

RADIAN [def=False] - If this keyword is set to True, then all output variables are given in Radians rather than Degrees

NOTES:

Patrick Wallace (Rutherford Appleton Laboratory, UK) has tested the accuracy of a C adaptation of the sunpos.pro code and found the following results. From 1900-2100 SUNPOS gave 7.3 arcsec maximum error, 2.6 arcsec RMS. Over the shorter interval 1950-2050 the figures were 6.4 arcsec max, 2.2 arcsec RMS.

The returned RA and Dec are in the given date’s equinox.

Procedure was extensively revised in May 1996, and the new calling sequence is incompatible with the old one.

METHOD:

Uses a truncated version of Newcomb’s Sun. Adapted from the IDL routine SUN_POS by CD Pike, which was adapted from a FORTRAN routine by B. Emerson (RGO).

EXAMPLE:
  1. Find the apparent RA and Dec of the Sun on May 1, 1982

IDL> jdcnv, 1982, 5, 1,0 ,jd ;Find Julian date jd = 2445090.5
IDL> sunpos, jd, ra, dec
IDL> print,adstring(ra,dec,2)
02 31 32.61 +14 54 34.9

The Astronomical Almanac gives 02 31 32.58 +14 54 34.9 so the error in SUNPOS for this case is < 0.5”.

  1. Find the apparent RA and Dec of the Sun for every day in 1997

IDL> jdcnv, 1997,1,1,0, jd ;Julian date on Jan 1, 1997
IDL> sunpos, jd+ dindgen(365), ra, dec ;RA and Dec for each day

MODIFICATION HISTORY:

  • Written by Michael R. Greason, STX, 28 October 1988.

  • Accept vector arguments, W. Landsman - April,1989

  • Eliminated negative right ascensions - MRG, Hughes STX, 6 May 1992.

  • Rewritten using the 1993 Almanac. Keywords added. MRG, HSTX, 10 February 1994.

  • Major rewrite, improved accuracy, always return values in degrees - W. Landsman May, 1996

  • Added /RADIAN keyword; W. Landsman; August, 1997

  • Converted to IDL V5.0; W. Landsman; September 1997

  • Converted to python; J. R. Lu; August 2016

model.get_angular_einstein_radius(m, d1, d2)
model.get_unit_vector(x)
model.get_u0(thetaE_hat, beta, thetaE_amp)
model.get_uhat(thetaE_hat, beta)
model.get_einstein_time(theta, v, days)
model.get_thetas(source, lens)
model.get_amplitudes(vectors)
model.get_unit_vectors(vectors)
model.get_plus(amps, hats, pos, lens, radius)
model.get_minus(amps, hats, pos, lens, radius)
model.oned_int(centre, function1, function2, ymax, ymin, n, x, middle, centres)
model.twod_int(centre, function1, function2, xmax, xmin, ymax, ymin, nx, ny, middle, centres)
model.twod_cent_x_int(centre, function1, function2, xmax, xmin, ymax, ymin, nx, ny, middle, centres)
model.oned_x_int(centre, function1, function2, ymax, ymin, n, x, middle, centres)
model.twod_cent_y_int(centre, function1, function2, xmax, xmin, ymax, ymin, nx, ny, middle, centres)
model.oned_y_int(centre, function1, function2, ymax, ymin, n, x, middle, centres)
model.get_image(y0, m1, d, R)

Function to find the images of the star

Parameters
y0:

position of the cente of the source star, in units of anguler Einstein radius

m1:

Mass of rightmost lens divided by the total mass

d:

separation of the lenses in angular Einstein radii

R:

angular radius of the source in angular Einstein radii