lvmsurveysim.utils

lvmsurveysim.utils.spherical.ellipse_bbox(ra, dec, a, b, pa, padding=0)[source]

Returns the bounding box in RA and Dec for a rotated ellipse.

All parameters must be float numbers in degrees. See EllipticalRegion for details.

lvmsurveysim.utils.spherical.get_altitude(ra, dec, jd=None, lst=None, lon=None, lat=None, airmass=False)[source]

Returns the altitude of an object from its equatorial coordinates in degrees.

Parameters
  • ra (float or ndarray) – The Right Ascension of the object(s) in degrees.

  • ra – The declination of the object(s) in degrees.

  • jd (float or ndarray) – The Julian Date or an array of dates. The local sidereal time will be calculated from these dates using the longitude.

  • lst (float or ndarray) – The local sidereal time, in hours. Overrides jd.

  • lon (float) – The longitude of the location.

  • lat (float) – The latitude of the location.

  • airmass (bool) – If True, returns the airmass (\sec z) instead of the altitude.

Returns

altitude (float or ndarray) – The altitude of the object at the given time. Returns the airmass if airmass=True.

lvmsurveysim.utils.spherical.get_lst(jd, lon)[source]

Returns the approximate Local Median Sidereal Time.

Parameters
  • jd (float or ndarray) – The Julian Date or an array of dates.

  • lon (float) – The longitude of the location.

Returns

lmst (float or ndarray) – The Local Median Sideral Time in hours. Same shape as the input jd.

lvmsurveysim.utils.spherical.great_circle_distance(ra0, dec0, ra1, dec1)[source]

Returns the great angle distance between two points.

Parameters
  • ra0 (float or ndarray) – The RA and Dec coordinates of the first point. In degrees.

  • dec0 (float or ndarray) – The RA and Dec coordinates of the first point. In degrees.

  • ra1 (float or ndarray) – The RA and Dec coordinates of the first point. In degrees.

  • dec1 (float or ndarray) – The RA and Dec coordinates of the first point. In degrees.

Returns

separation (float or ndarray) – The separation between the two sets of coordinates, in degrees.

lvmsurveysim.utils.plot.convert_to_mollweide(ra, dec)[source]

Converts [0, 360) coordinates to Mollweide-valid values.

Converts values to radians and offsets the Longitude to match the custom Mollweide projection used here. Flips RA so that E is left.

Parameters
  • ra (ndarray) – ra in degrees of coordinates to be converted

  • dec (ndarray) – dec in degrees of coordinates to be converted

Returns

ra0,dec0 in radians suitable to plot in mollwede projection

lvmsurveysim.utils.plot.get_axes(projection='rectangular', frame='icrs', ylim=None)[source]

Returns axes for a particular projection.

Parameters
  • projection (str) – The type of projection of the axes returned. Either 'rectangular' for a normal, cartesian, projection, or mollweide.

  • frame (str) – The reference frame of the axes. Must be one of _VALID_FRAMES. Used to define the axis labels.

  • ylim (tuple) – The range to be used to limit the y-axis. Only relevant if projection='rectangular'. If None, (-90, 90) will be used.

Returns

figax – The new matplotlib Figure and Axes objects for the selected projection.

lvmsurveysim.utils.plot.plot_ellipse(ax, ra, dec, width=3.0, height=None, origin=0, bgcolor='b', zorder=0, alpha=0.8)[source]

Plots an ellipse path of a given angular size.

lvmsurveysim.utils.plot.transform_patch_mollweide(patch)[source]

Applies a transformation to a patch for the Mollweide projection.

The Mollweide projection assumes the plotted values are in radians. In addition, the axes returned by get_axes for a Mollweide projection have the tick labels modified to place the centre at a different position from the default 0 rad. RA is flipped, so that East is left.

See also transform_to_mollweide.

Note that the Mollweide projection doesn’t provide wrapping. Large regions that cross the edge of the projection will not be displayed completely.

Parameters

patchpatch The patch to be transformed.

Returns

patch

patch

The transformed patch.

class lvmsurveysim.utils.shadow_height_lib.orbit_animation(calculator, jd0=None, djd=0.041666666666666664)[source]

Bases: object

animation_update_positions(frame)[source]
do_animation(N_days=1.0)[source]
init_plotting_animation()[source]
snap_shot(jd, ra, dec, show=True, extra=False)[source]
class lvmsurveysim.utils.shadow_height_lib.shadow_calc(observatory_name='LCO', observatory_elevation=<Quantity 2380. m>, observatory_lat='29.0146S', observatory_lon='70.6926W', jd=2459458, eph=None, earth=None, sun=None)[source]

Bases: object

cone_ra_dec()[source]
get_heights(mask=None, jd=None, return_heights=True, unit=Unit('km'))[source]
set_coordinates(ra, dec)[source]
solve_for_height(mask=None, unit='km')[source]
update_time(jd=None)[source]

Update the time, and all time dependent vectors

update_vec_c()[source]

d_se : distance sun to earth d_ec : distance earth to (c)one tip c_unit_vec: unit vector from cone to earth, or earth to sun.

update_xyz()[source]

Due to the nature of the vectors, it is not possible to combine the earth and the observatory topo directly. Therefore this requires the calculation of an observatory position to be done using the XYZ positions defined at a particular time, and with a particular unit. To prevent unit issues later from arising SI units are adopted. In the case where other units are desired, like plotting the solar system, local conversions can be done.

vecmag(a)[source]

Return the magnitude of a set of vectors around an abritrary origin

ts

These are going to be vectors which are the x,y,z positions of the puzzle. Credit for this solution to the intersection goes to: Julien Guertault @ http://lousodrome.net/blog/light/2017/01/03/intersection-of-a-ray-and-a-cone/

lvmsurveysim.utils.shadow_height_lib.test_shadow_calc()[source]
lvmsurveysim.utils.sqlite2astropy.astropy2peewee(table, model, replace=False)[source]

Save an astropy.table.Table into a pewwee SQL database using a given model. The model’s attributes MUST match the table’s column by name and type. Optionally insert or replace rows in the database.

Parameters
  • table (Table) – astropy Table object with the data to be stored. Columns must match the attribute names in the model exactly.

  • model (Model) – The peewee model of the database table to store into

  • replace (Boolean) – Replace rather than insert into the SQL table. Defaults to False.

lvmsurveysim.utils.sqlite2astropy.peewee2astropy(model)[source]

Create an astropy.table.Table object using a peewee database model class. Data are read from the corresponding SQL database.

Parameters

model (Model) – The model corresponding to the table to be read

Returns

table (~astropy.table.Table) – astropy Table object with the data from the database table. Column names match the attribute names in the model.

class lvmsurveysim.utils.geodesic_sphere.Vector(x, y, z)[source]

Bases: object

dot(v)[source]
norm()[source]
normalize()[source]
lvmsurveysim.utils.geodesic_sphere.initialize_sphere(depth)[source]

Create a geodesic sphere of triangles, starting with a icosahedron and subdividing the edges depth times.

returns a list of Vector of the vertices of the triangles

lvmsurveysim.utils.geodesic_sphere.sphere(N)[source]

Simple tiling of the sphere by uniformly distributing N samples in theta and N * sin(theta) in phi on a ring at each value of theta.

returns x,y,z coordinates on the unit sphere

lvmsurveysim.utils.geodesic_sphere.subdivide(v1, v2, v3, sphere_points, depth)[source]
lvmsurveysim.utils.geodesic_sphere.vecs_to_lists(vecs)[source]