Usage

Installation

To use luseepy, install the LuSEE-Night Docker image (For more information, see https://github.com/lusee-night/luseepy/tree/main/docker):

The “unity” Image

This is the minimal useable image based on requirements-foundation.txt. The main “Dockerfile” in the “docker” folder uses a build-arg argument, which also has a reasonable default. For example, building the “unity” image is done like this:

$ docker build . -f docker/Dockerfile-unity-luseepy -t lusee/lusee-night-unity-luseepy:1.0 --build-arg reqs=requirements-unity-luseepy.txt

Jupyter

This image also includes Jupyter Lab software. Jupyter is not started automatically, i.e. by default the user gets bash running and a functional Python/refspec/luseepy environment. To get Jupyter running, one first starts the container like this (or in a similar manner):

$ docker run -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -e JUPYTER_TOKEN=docker lusee/lusee-night-unity-luseepy:0.1

Once the container is running, this command is invoked to bring up Jupyter:

$ jupyter lab --allow-root --ip 0.0.0.0 --port 8888

The port 8888 can be mapped to any other convenient port on the host machine, and then access through localhost.

The Observation

class lusee.Observation.Observation(time_range=2500, lun_lat_deg=-23.814, lun_long_deg=182.258, lun_height_m=0, deltaT_sec=900)

Class that initializes a basic Lunar Observation object for an observatory in selenographic coordinates.

Lunar day can be specified as:

int = lunar day as per LunarCalendar
“CY##” or “CY####” = full calendar year 1/1 to 12/31
“FY##” or “FY####” = full fiscale year 10/1 to 9/30
“UTC to UTC”, i.e. ‘2025-02-01 13:00:00 to 2025-04-01 16:00:00’
param lunar_day:

Lunar day on which observation takes place

type lunar_day:

int or str, see above

param lun_lat_deg:

Lunar latitude of observatory in degrees

type lun_lat_deg:

float

param lun_long_deg:

Lunar longitude of observatory in degrees

type lun_long_deg:

float

param lun_height_m:

Height of observatory above lunar surface in meters

type lun_height_m:

float

param deltaT_sec:

Time resolution of observations

type deltaT_sec:

float

get_l_b_from_alt_az(alt, az, times=None)

Function that calculates a track in (l, b) galactic coordinates given coordinates in lunarcentric (Alt, Az). Alt and Az are given following the astronomical convention (angles measured from N towards E). Returns (l, b) in radians

Parameters:
  • alt (numpy array) – Altitude

  • az (numpy array) – Azimuth

  • times (numpy array) – Times for observation. Defaults to self.times if not specified

Returns:

(l, b) coordinates of object at self.times

Return type:

numpy array

get_ra_dec_from_alt_az(alt, az, times=None)

Function that calculates a track in (RA, Dec) given coordinates in lunarcentric (Alt, Az). Alt and Az are given following the astronomical convention (angles measured from N towards E). Returns (RA, Dec) in radians

Parameters:
  • alt (numpy array) – Altitude

  • az (numpy array) – Azimuth

  • times (numpy array) – Times for observation. Defaults to self.times if not specified

Returns:

(RA, Dec) coordinates of object at self.times

Return type:

numpy array

get_track_l_b(l, b, times=None)

Function that calculates a track in (Alt, Az) coordinates for an object with celestial coordinates (l, b) in the galactic coordinate system, at the self.times time stamps. (l, b) are given in degrees

Parameters:
  • l (numpy array) – Galactic longitude, zero angle is from sun to galactic center

  • b (numpy array) – Galactic latitude, measures angle above the galactic plane

  • times (numpy array) – Times for observation. Defaults to self.times if not specified

Returns:

(Alt, Az) coordinates of object at self.times

Return type:

numpy array

get_track_ra_dec(ra, dec, times=None)

Function that calculates a track in (Alt, Az) coordinates for an object with celestial coordinates in (RA, Dec) at the self.times time stamps. (RA, Dec) are given in degrees

Parameters:
  • ra (numpy array) – Right Ascension

  • dec (numpy array) – Declination

  • times (numpy array) – Times for observation. Defaults to self.times if not specified

Returns:

(Alt, Az) coordinates of object at self.times

Return type:

numpy array

get_track_solar(objid)

Function that calculates a track in (Alt, Az) coordinates for an object in the solar system at the self.times time stamps. objid can be ‘sun’, ‘moon’ (as debug, should be alt=-90), or planet id (jupiter, etc)

Parameters:

objid (str) – Object ID (‘sun’, ‘moon’, ‘jupiter’, etc.)

Returns:

(Alt, Az) coordinates of object at self.times

Return type:

numpy array

The Beams

class lusee.Beam.Beam(fname=None, id=None)

The main beam class, contains beam data and meta parameters. Only filename of beam to load and ID string are explicitly set in class initialization. All others are normally read in from the beam FITS file, but are included here in documentation for completeness.

Parameters:
  • fname (str) – Filename of beam to load

  • id (str) – ID string for beam, optional

  • version (int) – Beam version

  • Etheta (numpy array[complex]) – Theta component of electric field

  • Ephi (numpy array[complex]) – Phi component of electric field

  • ZRe (numpy array) – Real component of antenna impedance

  • ZIm (numpy array) – Imaginary component of antenna impedance

  • Z (numpy array[complex]) – Complex impedance

  • gain (numpy array) – Antenna gain

  • f_ground (numpy array) – Ground fraction

  • gain_conv (numpy array) – Gain convention

  • freq (numpy array) – Frequency list

  • freq_min (float) – Minimum frequency

  • freq_max (float) – Maximum frequency

  • Nfreq (int) – Number of frequencies

  • theta_min (float) – Minimum theta angle

  • theta_max (float) – Maximum theta angle

  • Ntheta (int) – Number of theta bins

  • phi_min (float) – Minimum phi angle

  • phi_max (float) – Maximum phi angle

  • Nphi (int) – Number of phi bins

  • header (dict) – File header

  • theta_deg (numpy array) – Array of theta bins in degrees

  • phi_deg (numpy array) – Array of theta bins in degrees

  • theta (numpy array) – Array of theta bins in radians

  • phi (numpy array) – Array of phi bins in radians

copy_beam(Etheta=None, Ephi=None)

Function that copies a beam object. Optional field array inputs to, eg. rotate copied beam.

Parameters:
  • Etheta (numpy array[complex]) – Optional new theta component of E-field

  • Ephi (numpy array[complex]) – Optional new phi component of E-field

Returns:

Beam copy

Return type:

class

cross_power(other)

Function that calculates the cross-power between two beams

Parameters:

other (class) – Second beam object for cross-power

Returns:

Cross power

Return type:

float

flip_over_yz()

Function that flips beams across yz plane

Returns:

Flipped beam as copy of beam object

Return type:

class

get_healpix(lmax, field, freq_ndx=None)

Function that produces a healpix map of specified field

Parameters:
  • lmax (int) – Maximum l value

  • field (numpy array[complex]) – Field to map (eg. Etheta)

  • freq_ndx (list(int)) – Optional list of frequency bin indices. Integer indices, not freq values

Returns:

Healpix field map

Return type:

numpy array

ground_fraction(cross=None)

Function that calculates the fraction of beam power that terminates on the ground (ground fraction), for a single beam or two crossed beams

Parameters:

cross (class) – Optional second beam object

Returns:

Ground fraction

Return type:

float

plotE(freqndx, toplot=None, noabs=False)

Function that plots 1D cuts of the E-field as a function of theta and phi

Parameters:
  • freqndx (list(int)) – List of frequency bins to plot. Integer indices, not freq values

  • toplot (list[np.array[complex]]) – Optional list of coord arrays to plot, eg. [self.Etheta, self.Ephi]. Defaults to full theta and phi arrays.

  • noabs (bool) – Whether to plot absolute value of E-field.

Returns:

None

power()

Function that calculates the beam power of a single beam

Returns:

Beam power

Return type:

float

power_hp(ellmax, Nside, freq_ndx=None, theta_tapr=None, cross=None, stokes=False)

Function that calculates the healpix rendering of the beam power

Parameters:
  • ellmax (int) – Maximum l value

  • Nside (int) – Size of output Healpix map

  • freq_ndx (list(int)) – Optional list of frequency bin indices. Integer indices, not freq values

  • theta_tapr (numpy array) – Optional tapering profile to apply to beam in theta direction

  • cross (class) – Optional second beam object for cross-power

  • stokes (bool) – Whether to compute Stokes parameters

Returns:

Healpix map containing beam power

Return type:

numpy array or list(numpy array) if type(freq_ndx) is not int

power_stokes(cross=None)

Function that calculates the beam power in Stokes components

Parameters:

cross (class) – Optional second beam object. If present, function will compute cross-power between the two beams given by “self” and “cross”. If absent, defaults to computing auto-power for “self” beam object.

Returns:

[I, Q, U, V]

Return type:

list[float]

rotate(deg)

Function that rotates the beam around the zenith (turntable rotation)

Parameters:

deg (float) – Rotational angle in degrees

Returns:

Rotated beam as copy of beam object

Return type:

class

sky_fraction(cross=None)

Function that calculates the fraction of beam power that terminates on the sky (sky fraction), for a single beam or two crossed beams

Parameters:

cross (class) – Optional second beam object

Returns:

Sky fraction

Return type:

float

lusee.Beam.getLegendre(lmax, theta)

Function that calculates Legendre polynomial functions up to specified degree

Parameters:
  • lmax (int) – Maximum degree of Legendre functions

  • theta (float) – Argument of Legendre function

Returns:

2D array of Legendre functions, array indices are l and m

Return type:

numpy array

lusee.Beam.grid2healpix(theta, phi, img, lmax, Nside, fast=True)

Function that converts from theta-phi orthogonal spherical coordinates to heapix coordinates

Parameters:
  • theta (numpy array) – Input spherical angle coordinates

  • phi (numpy array) – Input spherical angle coordinates

  • img (numpy array) – Input image (2D)

  • lmax (int) – Maximum l value

  • Nside (int) – Size of output Healpix map

  • fast (bool) – Whether to use fast a_lm method

Returns:

Healpix map of size Nside

Return type:

numpy array

lusee.Beam.grid2healpix_alm_fast(theta, phi, img, lmax)

Function that calculates a_lm spherical harmonic decomposition for input image, using fast method

Parameters:
  • theta (numpy array) – Input spherical angle coordinates

  • phi (numpy array) – Input spherical angle coordinates

  • img (numpy array) – Input image (2D)

  • lmax (int) – Maximum l value

Returns:

2D a_lm spherical harmonic array

Return type:

numpy array

lusee.Beam.grid2healpix_alm_reference(theta, phi, img, lmax)

Function that calculates a_lm spherical harmonic decomposition for input image

Parameters:
  • theta (numpy array) – Input spherical angle coordinates

  • phi (numpy array) – Input spherical angle coordinates

  • img (numpy array) – Input image (2D)

  • lmax (int) – Maximum l value

Returns:

2D a_lm spherical harmonic array

Return type:

numpy array

lusee.Beam.project_to_theta_phi(theta_rad, phi_rad, E)

Function that projects E_theta and E_phi components of instrument beam from E field in cartesian coordinates, E(x, y, z)

Parameters:
  • theta (numpy array) – Input spherical angle coordinates

  • phi (numpy array) – Input spherical angle coordinates

  • E (numpy array) – Electric field

Returns:

[Etheta, Ephi], Theta and phi components of electric field at [theta, phi] coordinates

Return type:

numpy array

The Gaussian Beam

class lusee.BeamGauss.BeamGauss(dec_deg, sigma_deg, phi_deg=90, one_over_freq_scaling=False, id=None)

Class that creates a Gaussian Beam object, centered at the given declination (and phi=360-azimuth=0) and of width sigma.

Parameters:
  • Beam (class) – Beam object

  • dec_deg (float) – Declination of the center of the gaussian beam, in degrees

  • sigma_deg – Sigma of the gaussian beam at 1MHz, in degrees

  • phi_deg (float) – Phi center of the gaussian beam, in degrees, phi=0->E, phi=90->N

  • one_over_freq_scaling (bool) – Whether to scale beam sigma with 1/f

  • id (str) – ID string for beam, optional

lusee.BeamGauss.gauss_beam(theta, phi, sigma, theta_c, phi_c=0.0)

Function that creates a map-level gaussian beam in theta and phi of width sigma, centered at theta=theta_c and phi=phi_c. Uses a naive gaussian function, with wrap around for theta, and phi. Used by BeamGauss class to create a Gaussiam Beam object.

Parameters:
  • theta (array) – Array of theta coordinates

  • phi (array) – Array of phi coordinates

  • sigma (float) – Beam width (standard deviation)

  • theta_c (float) – Beam center theta

  • phi_c (float) – Beam center phi

Returns:

Gaussian beam in theta and phi

Return type:

array

The Beam Couplings

class lusee.BeamCouplings.BeamCouplings(beams=[], from_yaml_dict=None)

Class that defines beam couplings for one and two port simulated beams

Parameters:
  • Beam (class) – Beam object

  • from_yaml_dict (class) – Beam items to load from yaml dictionary

Ex_coupling(b1, b2, freq_ndx)

Function that obtains E field cross coupling power for two input beams, b1 and b2

Parameters:
  • b1 (class) – Beam one

  • b2 (class) – Beam two

  • freq_ndx (int) – Frequency bin index at which to find cross power.

Returns:

Cross power between two input beams

Return type:

float

The Simulator

class lusee.Simulation.Simulator(obs, beams, sky_model, combinations=[(0, 0), (1, 1), (0, 2), (1, 3), (1, 2)], lmax=128, taper=0.03, Tground=200.0, freq=None, cross_power=None, beam_smooth=None, extra_opts={})

Simulator class

Parameters:
  • obs (class) – Observation parameters, from lusee.observation class

  • beams (class) – Instrument beams, from lusee.beam class

  • sky_model (class) – Simulated model of the sky, from lusee.skymodels

  • combinations (list[tuple]) – Indices for beam combinations/cross correlations to simulate

  • lmax (int) – Maximum l value of beams

  • taper (float) – Instrument beam taper

  • Tground (float) – Temperature of lunar ground

  • freq (list[float]) – Frequencies at which instrument observes sky. If empty, taken from lusee.beam class.

  • cross_power (list[float]) – Cross power for beam combinations. If empty, taken from lusee.beamcouplings.

  • beam_smooth (float) – Standard deviation of Gaussian filter for beam smoothing

  • extra_opt (list[str]) – Any extra options to pass to simulation. Currently includes “dump_beams” (saves instrument beams to file) and “cache_transform” (loads beam transformations from file).

prepare_beams(beams, combinations)

Function that prepares beams for simulator

Parameters:
  • beams (class) – Instrument beams, from lusee.beam object

  • combinations (list[tuple]) – Indices for beam combinations/cross correlations to simulate

simulate(times=None)

Main simulation function. Produces mock observation of sky model from self.sky_model with beams from self.beams

Parameters:

times (list) – List of times, defaults to lusee.observation.times if empty

Returns:

Waterfall style observation data for input times and self.freq

Return type:

numpy array

write(out_file)

Function that writes out instrument beam patterns from self.beams to fits file

Parameters:

out_file (str) – Name of the output file

lusee.Simulation.eul2rot(theta)

Function that converts from Euler angles to rotation matrix

Parameters:

theta (array) – Euler angles

Returns:

Rotation matrix

Return type:

numpy array

lusee.Simulation.mean_alm(alm1, alm2, lmax)

Function that calculates the mean of the product of two a_lm arrrays

Parameters:
  • alm1 (array) – First a_lm array

  • alm2 – Second a_lm array

  • lmax (int) – Maximum l value of beams

Returns:

Average alm

Return type:

float

lusee.Simulation.rot2eul(R)

Function that converts from rotation matrix to Euler angles

Parameters:

R (array) – Rotation matrix

Returns:

Euler angles

Return type:

numpy array

The Satellite classes

class lusee.Satellite.ObservedSatellite(observation, satellite)

Class that calculates satellite observables

Parameters:
  • observation (class) – Observation parameters, from lusee.observation class

  • satellite (class) – Satellite parameters, from lusee.satellite class

alt_rad()

Function that returns satellite altitude in radians

Returns:

Satellite altitude

Return type:

numpy array

az_rad()

Function that returns satellite azimuth in radians

Returns:

Satellite azimuth

Return type:

numpy array

dist_km()

Function that returns distance to satellite in km

Returns:

Satellite distance

Return type:

numpy array

get_track_coverage(Nphi=10, Nmu=10)

Function that returns array of alt-az bins showing where satellite transit passed. Bins are 1 if satellite passed through bin, 0 if not.

Parameters:
  • Nphi (int) – Number of az bins

  • Nmu (int) – Number of alt bins

Returns:

Binned satellite transits

Return type:

numpy array

get_transit_indices()

Function that returns an array of transit indices for satellite and observation times specified in ObservedSatellite class

Returns:

Transit Indices

Return type:

array

plot_tracks(ax, lin_map=False)

Function that plots satellite trajectories

Parameters:
  • ax – Plot axis object

  • lin_map (bool) – Use linear approximation for small altitudes?

class lusee.Satellite.Satellite(semi_major_km=5738, eccentricity=0.56489, inclination_deg=57.097, raan_deg=0, argument_of_pericenter_deg=72.625, aposelene_ref_time=<Time object: scale='utc' format='isot' value=2024-05-01T00:00:00.000>)

Class that defines satellite parameters and position

Parameters:
  • semi_major_km (float) – Semi-major axis of body in km

  • eccentricity (float) – Eccentricity of orbit

  • inclination_deg (float) – Inclination of orbit

  • raan_deg (float) – Right-ascension angle in degrees

  • argument_of_pericenter_deg (float) – Argument of pericenter of orbit in degrees

  • aposelene_ref_time (lunarsky.time) – Aposelene Reference Time

predict_position_mcmf(times)

Function that returns an array of satellite positions for input times

Parameters:

times (array[lunarsky.time]) – Array of lunarsky.time times at which to evaluate satellite position

Returns:

Position of satellite body

Return type:

Numpy array

The Monopole Sky Model classes

lusee.MonoSkyModels.B2T(B, f)

Function that returns sky temperature, T, in [K] from brightness, B, in [W/m*2/Hz/sr] and frequency, f, in [MHz]

Parameters:
  • B (float) – Sky brightness in [W/m*2/Hz/sr]

  • f (float) – Frequency in [MHz]

Returns:

Sky temperature, T, in [K]

Return type:

float

lusee.MonoSkyModels.B2V(B, f, leff, gamma)

Function that returns power spectral density in [V^2/Hz] for a dipole of effective length leff in [m] and preamp coupling efficiency gamma c.f. Zaslavsky (11)

Parameters:
  • B (float) – Sky brightness in [W/m*2/Hz/sr]

  • f (float) – Frequency in [MHz]

  • leff (float) – Effective dipole length in [m]

  • gamma (float) – Preamplifier coupling efficiency

Returns:

Power spectral density in [V^2/Hz]

Return type:

float

lusee.MonoSkyModels.B_C(f)

Function that returns sky brightness, B, in [W/m**2/Hz/sr] at frequency, f, in [MHz] according to the model of Cane from MNRAS 189.3 (1979): 465-478.

Parameters:

f (float) – Frequency in [MHz]

Returns:

Sky brightness in [W/m**2/Hz/sr]

Return type:

float

lusee.MonoSkyModels.B_NB(f)

Function that returns sky brightness, B, in [W/m**2/Hz/sr] at a frequency, f, in [MHz] according to the model of Novaco and Brown from ApJ 221 (1978): 114-123

Parameters:

f (float) – Frequency in [MHz]

Returns:

Sky brightness in [W/m**2/Hz/sr]

Return type:

float

class lusee.MonoSkyModels.BalePlasmaEffects(fname='R1_L300cm_n500t2k6v0nf300.sav')

Class that loads data from simulations by Stuart Bale modeling plasma effects on observed radio signal, and interpolates the signal at a specified frequency in [MHz].

Parameters:
  • fname (str) – Filename to load

  • freq_MHz (float) – Frequency in [MHz]

lusee.MonoSkyModels.T2B(T, f)

Function that returns sky brightness, B, in [W/m*2/Hz/sr] from temperature, T, in [K] and frequency, f, in [MHz]

Parameters:
  • T (float) – Sky temperature in [K]

  • f (float) – Frequency in [MHz]

Returns:

Sky brightness, B, in [W/m*2/Hz/sr]

Return type:

float

lusee.MonoSkyModels.T_C(f)

Function that returns sky temperature, T, in [K] at frequency, f, in [MHz] according to the model of Cane from MNRAS 189.3 (1979): 465-478.

Parameters:

f (float) – Frequency in [MHz]

Returns:

Sky temperature, T, in [K]

Return type:

float

lusee.MonoSkyModels.T_DarkAges_Scaled(nu, nu_min=16.4, nu_rms=14, A=0.04)

Function that rescales the location, width, and depth of the Dark Ages temperature decrement signal (the Dark Ages “trough”), and interpolates the temperature decrement at the specified frequencies, nuu. Dark Ages model uses the _DA_nu_cut and _DA_TSig_cut data, which are cut to below 50 MHz, and interpolated to zero at 50 MHz.

Parameters:
  • nu (list) – List of frequencies at which to calculate the Dark Ages temperature signal

  • nu_min (float) – Frequency of the minimum of the Dark Ages trough

  • nu_rms (float) – Width of the Dark Ages trough

  • A (float) – Monopole signal amplitude scaling factor

Returns:

Sky temperature, T, in [K]

Return type:

float

lusee.MonoSkyModels.T_J(f)

Function that returns sky temperature, T, in [K] at frequency, f, in [MHz] according to Eq. 2 of Chen et al (Exp Astronomy 2018 45:231-253)

Parameters:

f (float) – Frequency in [MHz]

Returns:

Sky temperature, T, in [K]

Return type:

float

lusee.MonoSkyModels.T_NB(f)

Function that returns sky temperature, T, in [K] at frequency, f, in [MHz] according to the model of Novaco and Brown from ApJ 221 (1978): 114-123

Parameters:

f (float) – Frequency in [MHz]

Returns:

Sky temperature, T, in [K]

Return type:

float

The Sky Model classes

class lusee.SkyModels.ConstSky(Nside, lmax, T, freq=None, zero_cone=True)

Class that initializes a healpix sky map with a frequency dependent monopole signal given by one of the available Constant Sky models: 1) the Cane (1979) radio background model, or 2) the Dark Ages monopole model

Parameters:
  • Nside (int) – Size of Healpix map to create

  • lmax (int) – Maximum l value for maps

  • T (int, float, or list) – Sky temperatures as a function of frequency, defined by model

  • freq (list) – List of frequencies at which to make sky maps

  • zero_cone (bool) – Explicitly zero pixels below horizon

T(ndx)

Function that returns sky temperature at specified frequency index or indices

Parameters:

ndx (list) – Frequency index at which to return temperature

Returns:

Sky temperature

Return type:

list

get_alm(ndx, freq=None)

Function that calculates a_lm spherical harmonic decomposition for input sky map(s) at specified frequency indices. Uses healpy map2alm.

Parameters:
  • ndx (list) – Frequency index or list of indices

  • freq (list) – Frequency list. Not currently implemented.

Returns:

A_lm array

Return type:

array

class lusee.SkyModels.ConstSkyCane1979(Nside, lmax, freq=None)

Class that constructs a monopole sky temperature map using the Cane (1979) radio background sky model. Uses ConstSky class to initialize map.

Parameters:
  • Nside (int) – Size of Healpix map to create

  • lmax (int) – Maximum l value for maps

  • freq (list) – List of frequencies at which to make sky maps. If freq=None, defaults to 1-50 MHz with 1 MHz spacing.

class lusee.SkyModels.DarkAgesMonopole(Nside, lmax, scaled=True, nu_min=16.4, nu_rms=14.0, A=0.04, freq=None)

Class that constructs a monopole sky temperature map using the Dark Ages monopole model. Uses ConstSky class to initialize map. Can optionally generate maps from the monopole model scaled to specified nu_min, nu_rms, and A, or from an explicit list of temperatures, T, as a function of frequency. Scaled model given by lusee.MonoSkyModels.T_DarkAges_Scaled, non-scaled by lusee.MonoSkyModels.T_DarkAges.

Parameters:
  • Nside (int) – Size of Healpix map to create

  • lmax (int) – Maximum l value for maps

  • scaled (bool) – Whether to generate maps from frequency scaled model (True), or temperature list model (False)

  • nu_min (float) – Frequency of the minimum of the Dark Ages trough

  • nu_rms (float) – Width of the Dark Ages trough

  • A (float) – Monopole signal amplitude scaling factor

  • freq (list) – List of frequencies at which to make sky maps.

class lusee.SkyModels.FitsSky(fname, lmax)

Class that reads in a sky map from a FITS file, and reads in the freq list from the FITS header. Computes map A_lms with healpy map2alm, up to specified lmax.

Parameters:
  • fname (str) – Filename to read in

  • lmax (int) – Maximum l value for maps

get_alm(ndx, freq)

Function that calculates a_lm spherical harmonic decomposition for input FITS file sky map(s) at specified frequency indices. Uses healpy map2alm.

Parameters:
  • ndx (list) – Frequency index at which to return temperature

  • freq (list) – List of frequencies at which to make sky maps.

Returns:

A_lm array

Return type:

array

class lusee.SkyModels.GalCenter(Nside, lmax, T, freq=None)

Class that constructs a temperature map using the Galaxy Center model. Uses ConstSky class to initialize map.

Parameters:
  • Nside (int) – Size of Healpix map to create

  • lmax (int) – Maximum l value for maps

  • T (int, float, or list) – Sky temperatures as a function of frequency, defined by model

  • freq (list) – List of frequencies at which to make sky maps.

The Lunar Calendar

class lusee.LunarCalendar.LunarCalendar(cache='', cleanup=True, verbose=False)

Class that defines the cache file name and sets whether it is to be used

Parameters:
  • cache – Cache file name

  • cleanup (bool) – Whether to remove cache on close

  • verbose (bool) – Whether to print extended function details and errors

close_db()

Function that closes cache, removes it if cleanup set to true

Returns:

None

get_lunar_nights(year=2025)

Function that calculates a list of lunar noon-to-noon cycles in a year. Returns a list of tuples. Each tuple is (time_start, time_end) Where times are astropy times at lunar “noon” (Sun transits) on the farside time_end corresponds to time_start of the next day.

Parameters:

year (int) – Year for which to calculate

Returns:

Start and end times of lunar cycles in specified year

Return type:

list(tuple)

get_lunar_start_end(lunar_night=2500)

Function that calculates dates for specified noon-to-noon lunar cycle. Format of cycles is: two digit year in 21st century, followed by zero-indexed two digit cycle count for that year. E.g.: 2600 is the first lunar cycle in 2026.

Parameters:

lunar_night (int) – Lunar cycle number

Returns:

Cycle start and end dates

Return type:

tuple

get_sun_alt(times)

Function that returns Sun altitude at a given Moon location for a set of times

Parameters:

times (numpy array) – Array of times at which to calculate sun alt

Returns:

Altitudes

Return type:

numpy array

The Throughput

class lusee.Throughput.Throughput(beam=None, noise_e=2, Cfront=35, R4=1000000.0)

Class that holds front-end throughput parameters

Parameters:
  • beam (class) – Beam class object

  • noise_e (float) – Amplifier noise in nV/rtHz

  • Cfront (float) – Front-end capacitance in pico-farads

  • R4 (float) – Front-end resistance in Ohms

AntennaImpedanceInterp(f)

Function that extrapolates antenna impedance as a function of frequency

Parameters:

f (array) – Array of frequencies at which to calculate impedance

Returns:

Antenna impedance

Return type:

array

Gamma_VD(freq)

Function that calculates gamma at a specified frequency for antenna impedance matching

Parameters:

freq (float) – Frequency in Hz

Returns:

Gamma_VD

Return type:

float

SG2V(freq)

Function that calculates 4*lambda*R*Gamma^2 for antenna match

Parameters:

freq (float) – Frequency

Returns:

T2Vsq

Return type:

float

T2Vsq(freq)

Function that calculates 4*k_B*R*Gamma^2 for antenna match

Parameters:

freq (float) – Frequency

Returns:

T2Vsq

Return type:

float

complex_gain(freq_MHz, gain_set='M')

Function that calculates the complex gain of the front-end amplifiers at a specified frequency

Parameters:
  • freq_MHz (float) – Frequency in MHz

  • gain_set (str) – Gain setting

Returns:

Complex gain at input frequency

Return type:

complex

power_gain(freq_MHz, gain_set='M')

Function that calculates the gain of the front-end amplifiers in power at a specified frequency

Parameters:
  • freq_MHz (float) – Frequency in MHz

  • gain_set (str) – Gain setting

Returns:

Gain in power

Return type:

float

setCfront(Cfront)

Function that sets the front-end capacitance in the Throughput class

Parameters:

Cfront (float) – Front-end capacitance in pico-farads

Returns:

None

Return type:

None

The Data

class lusee.Data.Data(filename, throughput=None)

Class that holds data from an observation

Parameters:
  • filename (str) – Filename of observation to load

  • throughput (class) – Front-end throughput parameters

class lusee.Data.ThroughputBeam(freq, Z)

Dummy class that contains complex impedance for Throughput class

Parameters:
  • freq (float) – Frequency

  • Z (numpy array[complex]) – Complex impedance

The PCA Analyzer

class lusee.PCAanalyzer.CompositePCAanalyzer(alist)

Class that performs Principle Component Analysis on the composite of several sets of sky data

Parameters:

alist (list(class)) – list of PCAanalyzer classes for the sky data sets

SNR(template_list, plot=None, verbose=False)

Function that calculates the signal-to-noise ratio of input sky signal template against sky noise

Parameters:
  • template_list (list(array)) – List of sky signal templates

  • plot (bool) – Whether to plot results

  • verbose (bool) – Whether to print SNR for each analyzer in list

Returns:

SNR

Return type:

float

get_chi2(template_list, data, istart=2)

Function that calculates the cumulative Chi-squared value for the list of sky data and sky signal templates in self.alist and template_list

Parameters:
  • template_list (list(array)) – List of sky signal templates

  • data (list(array)) – List of sky data sets

  • istart (int) – Frequency index at which to start

Returns:

Chi-squared

Return type:

get_chi2_table(templates, data, istart=2)

Function that calculates an array of Chi-squared values for a list of different templates, with each template applied to every analyzer in self.alist and set of sky data in data

Parameters:
  • templates (list(array)) – List of sky signal templates

  • data (list(array)) – List of sky data sets

  • istart (int) – Frequency index at which to start

Returns:

Chi-squared array

Return type:

array

sim_data(template_list)

Function that calculates simulated sky spectra for each set of sky data in self.alist, and each sky signal template in template_list

Parameters:

template_list (list(array)) – List of sky signal templates

Returns:

Simulated sky spectra

Return type:

list(array)

class lusee.PCAanalyzer.PCAanalyzer(data, noise, weight=None)

Class that performs Principle Component Analysis on sky data and sky signal templates

Parameters:
  • data (class) – Sky data for analysis, two dimensional array where second dimension is frequency

  • noise (array) – Noise array for data at N frequencies

  • weight (array) – Weight array for data at N frequencies

SNR(template, plot=None)

Function that calculates the signal-to-noise ratio of input sky signal template against sky noise

Parameters:
  • template (array) – Sky signal template

  • plot (bool) – Whether to plot results

Returns:

SNR

Return type:

float

get_chi2(template, data, istart=2)

Function that calculates the Chi-squared value of the input sky signal template against sky data

Parameters:
  • template (array) – Sky signal template

  • data (array) – Sky data

  • istart (int) – Frequency index at which to start

Returns:

Chi-squared

Return type:

float

get_chi2_table(templates, data, istart=2)

Function that calculates the Chi-squared value of a list of input sky signal templates against sky data

Parameters:
  • templates (list(array)) – List of sky signal templates

  • data (array) – Sky data

  • istart (int) – Frequency index at which to start

Returns:

Chi-squared array

Return type:

array

get_template_power(template)

Function that calculates power from weighted sky signal template

Parameters:

template (array) – Sky signal template

Returns:

Power in sky signal

Return type:

array

sim_data(template)

Function that calculates a simulated sky spectrum by summing 1) The mean un-weighted sky data in each frequency bin (from the sky data input to the PCAanalyzer class) as a background DC level, 2) the input sky signal template, and 3) a randomly generated instance of sky noise, with mean zero and standard deviation self.noise, at each of the N frequencies in the input sky data.

Parameters:

template (array) – Sky signal template

Returns:

Simulated sky spectrum

Return type:

array