ROSALIA package

Submodules

rosalia.albedo module

rosalia.albedo.find_albedo(lon, lat, healpix_map_name)
rosalia.albedo.read_MODIS_albedo(modis_file, scaling_factor=0.001)
rosalia.albedo.regrid_modis_to_healpix(modis_file, nside, outfile, scaling_factor=0.001, extension='Albedo_WSA_vis')

rosalia.astrometry module

rosalia.astrometry.astrometry_list(fitslist, refcat=None, refxcol=None, refycol=None, force_tweakreg=False, correct_crs=False)
rosalia.astrometry.clean_crs(input_list)
rosalia.astrometry.copy_header(file_to_write, reference_file, copy_data=False)
rosalia.astrometry.generate_tweakreg_catfile(input_list, catfile_name='catfile_default.txt')
rosalia.astrometry.get_parameters_list(fits_list, index, ext=0)
rosalia.astrometry.separate_visits(fitslist)
rosalia.astrometry.source_extractor(input_fits, ext, sn=3)

rosalia.attitude module

File: Roman_Attitude.py Author: Maxime J Rizzo Email: maxime.j.rizzo@nasa.gov Date: 2025-11-18

class rosalia.attitude.RomanPointing(observation_date=None)

Bases: object

Spacecraft orientation and pointing for celestial targets.

This module provides functionality for calculating and visualizing spacecraft attitude, target coordinates, and sun angles for astronomical observations. It supports operations in various coordinate systems including ICRS, ecliptic, and galactic.

Key features: - Calculate spacecraft attitude for given celestial targets - Convert between different coordinate systems - Visualize pointing and attitude in 3D and 2D projections - Handle pitch and roll maneuvers - Check visibility constraints

delta_pitch_roll(dpitch=0.0, droll=0.0)

Calculate new pointing coordinates after applying pitch and roll offsets.

Parameters:

dpitchfloat, optional

Change in pitch angle in degrees. Default is 0.0.

drollfloat, optional

Change in roll angle in degrees. Default is 0.0.

Returns:

rafloat

New Right Ascension in degrees.

decfloat

New Declination in degrees.

pafloat

New Position Angle in degrees.

new_pitchfloat

New pitch angle in degrees.

Notes:

This method applies a pitch rotation followed by a roll rotation to the current spacecraft attitude. It then calculates the new pointing coordinates, position angle, and pitch angle based on the resulting attitude.

get_attitude_euler(attitude=None, sequence='ZYX', degrees=True)

Get attitude as Euler angles Parameters: ———– attitude: 3x3 numpy array, optional spacecraft attitude matrix sequence: str, rotation sequence degrees: bool, if True return angles in degrees, else in radians

Returns:

numpy array, Euler angles

get_attitude_quaternion(attitude=None)

Get attitude as quaternion [w, x, y, z] Parameters: ———– attitude: 3x3 numpy array, optional spacecraft attitude matrix

Returns:

numpy array, quaternion representation of attitude

get_ecliptic_coordinates(coord)

Convert coordinates to ecliptic longitude and latitude

Parameters:

coord: SkyCoord object

Returns:

tuple, (ecliptic longitude, ecliptic latitude) in degrees

get_pitch_angle(target=None)

Get the pitch angle between the spacecraft pointing and the Sun.

Parameters:

targetastropy.coordinates.SkyCoord, optional

The target coordinates. If not provided, uses the current target_coord.

Returns:

astropy.units.Quantity

The pitch angle in degrees. Positive values indicate the spacecraft is pitched up relative to the Sun, negative values indicate it’s pitched down.

Notes:

The pitch angle is defined as the angle between the spacecraft-Sun vector and the spacecraft pointing direction, minus 90 degrees. This means a pitch of 0 degrees corresponds to the Sun being perpendicular to the pointing direction.

get_position_angle(attitude=None)

Compute the position angle (V3PA) of the spacecraft.

Position Angle is the angle from the plane containing the +X axis and the vector to Celestial North to the plane containing the +X and +Z axes, measured in the direction of celestial east as viewed from the spacecraft origin.

Parameters:

x_axisarray_like

Spacecraft +X axis direction vector (3D)

z_axisarray_like

Spacecraft +Z axis direction vector (3D)

north_vectorarray_like, optional

Celestial North direction vector (default: [0,0,1] for +Z celestial)

Returns:

position_anglefloat

Position angle in radians

get_sun_angle(target=None)

Get angle between spacecraft pointing direction and Sun.

Parameters:

targetastropy.coordinates.SkyCoord, optional

The target coordinates. If not provided, uses the current target_coord.

Returns:

float or None

The angular separation between the target and the Sun in degrees. Returns None if no target is set and no target is provided.

Notes:

This method calculates the angular separation between the spacecraft’s pointing direction (or provided target) and the Sun’s position.

get_target_new_pitch(delta_pitch=0.0)

Compute the RA and DEC of a new target offset in pitch angle.

Parameters:

delta_pitchfloat, optional

The pitch angle offset in degrees. Positive values pitch away from Sun, negative values pitch towards Sun. Default is 0.0.

Returns:

targetastropy.coordinates.SkyCoord

A SkyCoord object representing the new target’s position in ICRS coordinates.

new_attitudenumpy.ndarray

A 3x3 array representing the new spacecraft attitude matrix.

Notes:

The function uses the current spacecraft attitude and applies a rotation around the Y-axis (pitch) to determine the new pointing direction.

is_visible()

Check if the current target is within the pitch limits and thus visible.

Returns:

bool

True if the target is within the pitch limits, False otherwise.

print_roman_pointing_attributes()

Prints all attributes of the RomanPointing class cleanly.

Parameters:

pointing: RomanPointing object

set_target(target, roll=0.0)

Set target using SkyCoord object

Parameters:

target: SkyCoord object roll: float, Sun roll angle from nominal in degrees

set_target_using_radec(ra, dec, roll=0.0, frame='icrs', unit='deg')

Set target star coordinates

Parameters:

ra: float, right ascension dec: float, declination roll: float, Sun roll angle from nominal in degrees frame: str, coordinate frame (‘icrs’, ‘fk5’, etc.) unit: str, angular unit (‘deg’, ‘hour’ for RA, etc.)

visualize_pointing(show_ecliptic=True, show_sun=True, show_constellation_grid=False, fig_size=(15, 10), target_list=None)

Visualize spacecraft pointing in celestial sphere context

Parameters: show_ecliptic: bool, show ecliptic plane show_sun: bool, show Sun position show_constellation_grid: bool, show RA/DEC grid fig_size: tuple, figure size

rosalia.attitude.create_subplot_grid(n_plots, figsize_per_plot=(4, 3), max_cols=None, spacing={'hspace': 0.3, 'wspace': 0.3}, sharey=True, sharex=True)

Create an optimal grid layout for an arbitrary number of plots

Parameters:

n_plots: Number of plots to create figsize_per_plot: Size of each individual plot (width, height) max_cols: Maximum number of columns (None for automatic) spacing: Dictionary with hspace and wspace for subplot spacing

Returns:

fig: Figure object axes: Array of axes objects (flattened)

rosalia.attitude.generate_power_law_sampling(n_points=14, range_max=36, power=3)

Uses power law transformation for strong edge emphasis Higher power = more edge clustering

rosalia.attitude.get_large_aperture(attitude_matrix, named_aperture='WFI_CEN', scalex=1.2, scaley=1.4)
rosalia.attitude.get_radec(attitude_matrix)

Compute RA and DEC from spacecraft attitude matrix in icrs.

Parameters:

attitude_matrix: 3x3 numpy array, spacecraft attitude matrix in icrs

Returns:

ra: float, Right Ascension in degrees dec: float, Declination in degrees

rosalia.attitude.get_vector(target)

Convert SkyCoord object to unit vector. Parameters: ———– target: SkyCoord object

Returns:

vector: numpy array, unit vector representation of target

rosalia.attitude.load_targets(target_list)

Load target coordinates from Excel file. Parameters: ———– target_list: str, path to Excel file containing target coordinates

Returns:

tgt_list: list of SkyCoord objects

rosalia.attitude.main()
rosalia.attitude.plot_targets_by_magnitude(x_coords, y_coords, magnitudes, ax=None, title='Target Distribution by Magnitude', show_colorbar=True, show_legend=True, show_stats=True, minmag=5, maxmag=17)

Create a scatter plot with marker sizes based on astronomical magnitudes.

Parameters: x_coords: list or array of X coordinates y_coords: list or array of Y coordinates magnitudes: list or array of astronomical magnitudes ax: matplotlib axis object (if None, creates new figure) title: plot title show_colorbar: whether to show colorbar (default True) show_legend: whether to show magnitude legend (default True) show_stats: whether to print statistics (default True)

Returns: ax: the axis object used for plotting scatter: the scatter plot object (useful for external colorbar creation)

rosalia.constants module

rosalia.correct module

rosalia.correct.correct_zody(input_name, verbose=False)
rosalia.correct.do_astrometry(input_name, refcat=None, refxcol=None, refycol=None, force_tweakreg=False, correct_crs=False)
rosalia.correct.download_mast(ra, dec, radius, filters, extension, instrument_name, project, obs_collection='HST')
rosalia.correct.estimate_straylight_in_detector_locations(input_name, ext, ra, dec, stars_world_location, synthetic_mag, image_identity, step, grid_method, ndi_mode, bool_image_mode, verbose)
rosalia.correct.rosalia_psf(ra, dec, PA, g_mag_max, date, bandpass, exptime, input_catalog=None, verbose=False)

rosalia_psf: Alejandro S. Borlaff. NASA Ames Research Center. Model the stars inside a Roman WFI image. This is useful for estimating the straylight from stars inside the field of view, and for subtracting the stars from the image.

Args:
ra (float):

Right ascension of the pointing, in degrees.

dec (float):

Declination of the pointing, in degrees.

PA (float):

Position angle of the observation, in degrees.

g_mag_max (float):

Maximum g magnitude of the stars to consider in the model.

date (astropy.time.Time):

Date of the observation in YYYY-MM-DDTHH:MM:SS format.

bandpass (str):

Bandpass of the observation in Roman WFI filter names (e.g., F062, F087, F106, F129, F158, F184, F213).

exptime (float):

Exposure time of the observation, in seconds.

input_catalog (pandas.DataFrame, optional):

User-provided catalog of stars. Must contain columns: “ra”, “dec”, “source_id”, “cat_id”, “mag_lambda”.

verbose (bool, optional):

If True, print more information about progress. Default is False.

rosalia.correct.rosalia_stray(ra, dec, PA, date, bandpass, exptime, prefix='', input_fits=None, radius=1, g_mag_max=15, sun_block=False, verbose=False, catalog=None, figsize=(10, 7), mu_vmin=None, mu_vmax=None)

Identify and estimate straylight from stars outside the field of view.

Estimates the straylight from stars outside the field of view for Roman Space Telescope Wide Field Instrument observations.

Args:
ra (float):

Right ascension of the pointing, in degrees.

dec (float):

Declination of the pointing, in degrees.

PA (float):

Position angle of the observation, in degrees.

date (astropy.time.Time):

Date of the observation in YYYY-MM-DDTHH:MM:SS format.

bandpass (str):

Bandpass of the observation in Roman WFI filter names (e.g., F062, F087, F106, F129, F158, F184, F213).

exptime (float):

Exposure time of the observation, in seconds.

radius (float, optional):

Radius around the pointing to search for stars, in degrees. Default is 1.

g_mag_max (float, optional):

Maximum g magnitude of the stars to consider in the straylight estimation. Default is 15.

sun_block (bool, optional):

If True, the Sun will be removed from the star catalog. Default is False.

verbose (bool, optional):

If True, print more information about progress. Default is False.

catalog (pandas.DataFrame, optional):

User-provided catalog of stars. Must contain columns: “ra”, “dec”, “source_id”, “cat_id”, “mag_lambda”. If provided, skips querying Gaia/2MASS/WISE catalogs. Default is None.

Returns:
pandas.DataFrame: Estimated straylight from each star outside the field

of view with metadata. Columns: “source_id”, “cat_id”, “ra”, “dec”, “mag_lambda”, “straylevel”, “main_offender”, “mosaic_name”, “mosaic_name_scaled”.

History:

v1 - 29 Feb 2024. First working version in a public release.

Author:

Alejandro S. Borlaff (NASA Ames Research Center, a.s.borlaff@nasa.gov)

rosalia.correct.rosalia_zody(ra, dec, PA, date, bandpass, exptime, verbose=False, output_name=None, output_units='e/s')
rosalia.correct.subtract_stars(input_name, clean=True, verbose=False)

rosalia.detectors module

rosalia.detectors.HST_ACS_counts_to_jy(flux_ACS, photflam, photplam)
rosalia.detectors.HST_ACS_jy_to_counts(flux_jy, photflam, photplam)
rosalia.detectors.fe2mu(fe, instrument, filter_name, telescope, verbose=False)
rosalia.detectors.get_detector_corners(wcs)
rosalia.detectors.make_array_grid(array, step, mode='random', nborder_points=64)
rosalia.detectors.make_detector_grid(w, step, mode='random')
rosalia.detectors.mu2fe(mu, instrument, filter_name, telescope, verbose=False)

rosalia.gaia module

rosalia.gaia.find_ra_dec_constraints(ra, dec, radius, verbose=False)
rosalia.gaia.query_gaia_2mass_wise(ra, dec, radius, g_mag_max=False, verbose=False, query_filename='gaia_query.dat')
rosalia.gaia.query_healpix_ra_slices(healpix_lvl=7, verbose=False)

rosalia.horizons module

rosalia.horizons.find_moon_and_jupiter_in_HST_history(obs_history, chunksize=50)
rosalia.horizons.get_jpl_observer_name(observer_name)
rosalia.horizons.get_mpc_observer_name(observer_name)
rosalia.horizons.horizons_query(mjd, source='301', location='@jwst', chunk_size=50)
rosalia.horizons.single_horizons_query(mjd, source='301', location='@hst')

rosalia.irsa module

rosalia.irsa.irsa_query(ra, dec, wavelength, year, day, obslocin)
rosalia.irsa.irsa_query_single(ra, dec, wavelength, year, day, obslocin)
rosalia.irsa.launch_irsa_query(ra, dec, wavelength, year, day, obslocin=3)
rosalia.irsa.read_irsa_query(xml_query_name)

rosalia.ndi module

rosalia.ndi.make_ndi_polar_radial_profile(data, header, center=None, n_phi_bins=360, n_theta_bins=300, verbose=False, mode='average')
class rosalia.ndi.ndi_euclid

Bases: object

This class contains the methods to calculate the NDI at different distances and orientations as a function of the Euclid NDI model (numeric envelope or non-axisymmetric ray-tracing model) as defined in EUCL-EST-TN-3-008_v2.0 Assessment e2e straylight performance.

FxVIS = array([ 0.        ,  0.        ,  0.        , -0.38995199, -0.38995199,        -0.38995199,  0.38995199,  0.38995199,  0.38995199])
FxyVIS = array([[ 0.        ,  0.3508274 ],        [ 0.        ,  0.        ],        [ 0.        , -0.3508274 ],        [-0.38995199,  0.3508274 ],        [-0.38995199,  0.        ],        [-0.38995199, -0.3508274 ],        [ 0.38995199,  0.3508274 ],        [ 0.38995199,  0.        ],        [ 0.38995199, -0.3508274 ]])
FyVIS = array([ 0.3508274,  0.       , -0.3508274,  0.3508274,  0.       ,        -0.3508274,  0.3508274,  0.       , -0.3508274])
NDI_A0550 = array([240, 126,  84, 300, 177, 126, 180,  90,  54])
NDI_theta1s = array([0.015, 0.02 , 0.025, 0.013, 0.017, 0.02 , 0.017, 0.024, 0.031])
NDI_x = array([ 0.        ,  0.        ,  0.        , -0.38995199, -0.38995199,        -0.38995199,  0.38995199,  0.38995199,  0.38995199])
NDI_xy = array([[ 0.        ,  0.3508274 ],        [ 0.        ,  0.        ],        [ 0.        , -0.3508274 ],        [-0.38995199,  0.3508274 ],        [-0.38995199,  0.        ],        [-0.38995199, -0.3508274 ],        [ 0.38995199,  0.3508274 ],        [ 0.38995199,  0.        ],        [ 0.38995199, -0.3508274 ]])
NDI_y = array([ 0.3508274,  0.       , -0.3508274,  0.3508274,  0.       ,        -0.3508274,  0.3508274,  0.       , -0.3508274])
a_ndi(y, theta, n_lambda)

This method calculates a as a function the position on the detector x,y the theta = distance from the straylight source and the n_lambda (wavelength in nm) Required by the method ndi_envelope to calculate the NDI profile A(θ_DEG, λ_nm ) = A(0, 550) *([λ_nm/550)]^(n(θ_DEG))

max_x = 0.38995199388888885
max_y = 0.3508274015277778
n_ndi()

This method calculates n as a function of theta = distance from the straylight source. Required by the method ndi_envelope to calculate the NDI profile n(θ_DEG) = n(0)*1/((1+[(θ_DEG/θ_wd1 )]^0.75 ) )*1/((1+[(θ_DEG/θ_wd2 )]^20 ) )

ndi_envelope(y, theta, n_lambda)

This method calculates the NDI profile as a function the position on the detector x,y the theta = distance from the straylight source and the n_lambda (wavelength in nm) NDI (θ_DEG,λ_nm) = A(θ_DEG,λ_nm)*1/((1+[(θ_DEG/θ_1s )]^2))*((1+[(θ_DEG/θ_2e )]^4 ))/((1+[(θ_DEG/θ_2s )]^4))

ntheta0 = -1.8
plate_scale = 8.333
theta2e = 35
theta2s = 15
thetawd1 = 0.3
thetawd2 = 2
rosalia.ndi.straylight_flux(mag, theta, phi, filter_name, instrument, telescope, exptime, mu_mode=False, verbose=False, ndi_mode='legacy')

rosalia.plots module

class rosalia.plots.Loader(desc='Loading...', end='Done!', timeout=0.1)

Bases: object

start()
stop()
class rosalia.plots.ascii_progress_focal_plane

Bases: object

SCA_list = ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
canvas = array([' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '\n', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_',        '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '\n', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_',        '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_',        '_', '_', '_', '_', '_', ' ', '\n', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '\n', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '\n', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '\n', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '\n', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '\n', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\n',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', '\n'], dtype='<U1')
canvas_zero = array([' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '\n', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_',        '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '\n', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_',        '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_',        '_', '_', '_', '_', '_', ' ', '\n', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '\n', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_',        ' ', '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_',        '_', '_', '_', '_', ' ', '\n', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '_', '_', '_', '_', '_', '_', '_', '_', ' ', '\n', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ',        '\n', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_',        '_', '_', '_', ' ', '\n', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_',        '_', '_', '_', '_', '_', '_', '_', ' ', '\n', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', '_', '_',        '_', '_', '_', '_', '_', '_', ' ', '_', '_', '_', '_', '_', '_',        '_', '_', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\n',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', '_', '_', '_', '_', '_', '_', '_',        '_', ' ', '_', '_', '_', '_', '_', '_', '_', '_', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', '\n'], dtype='<U1')
sca_mask = array([' ', 'g', 'g', 'g', 'g', 'g', 'g', 'g', 'g', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', '7', '7', '7', '7', '7', '7',        '7', '7', ' ', '\n', ' ', 'g', 'g', 'g', 'g', 'g', 'g', 'g', 'g',        ' ', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', '4', '4', '4', '4', '4', '4', '4', '4', ' ', '7', '7',        '7', '7', '7', '7', '7', '7', ' ', '\n', ' ', 'g', 'g', 'g', 'g',        'g', 'g', 'g', 'g', ' ', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd',        ' ', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', ' ', '1', '1', '1',        '1', '1', '1', '1', '1', ' ', '4', '4', '4', '4', '4', '4', '4',        '4', ' ', '7', '7', '7', '7', '7', '7', '7', '7', ' ', '\n', ' ',        'g', 'g', 'g', 'g', 'g', 'g', 'g', 'g', ' ', 'd', 'd', 'd', 'd',        'd', 'd', 'd', 'd', ' ', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a',        ' ', '1', '1', '1', '1', '1', '1', '1', '1', ' ', '4', '4', '4',        '4', '4', '4', '4', '4', ' ', '7', '7', '7', '7', '7', '7', '7',        '7', ' ', '\n', ' ', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', ' ',        'd', 'd', 'd', 'd', 'd', 'd', 'd', 'd', ' ', 'a', 'a', 'a', 'a',        'a', 'a', 'a', 'a', ' ', '1', '1', '1', '1', '1', '1', '1', '1',        ' ', '4', '4', '4', '4', '4', '4', '4', '4', ' ', '8', '8', '8',        '8', '8', '8', '8', '8', ' ', '\n', ' ', 'h', 'h', 'h', 'h', 'h',        'h', 'h', 'h', ' ', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', ' ',        'a', 'a', 'a', 'a', 'a', 'a', 'a', 'a', ' ', '1', '1', '1', '1',        '1', '1', '1', '1', ' ', '5', '5', '5', '5', '5', '5', '5', '5',        ' ', '8', '8', '8', '8', '8', '8', '8', '8', ' ', '\n', ' ', 'h',        'h', 'h', 'h', 'h', 'h', 'h', 'h', ' ', 'e', 'e', 'e', 'e', 'e',        'e', 'e', 'e', ' ', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', ' ',        '2', '2', '2', '2', '2', '2', '2', '2', ' ', '5', '5', '5', '5',        '5', '5', '5', '5', ' ', '8', '8', '8', '8', '8', '8', '8', '8',        ' ', '\n', ' ', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', ' ', 'e',        'e', 'e', 'e', 'e', 'e', 'e', 'e', ' ', 'b', 'b', 'b', 'b', 'b',        'b', 'b', 'b', ' ', '2', '2', '2', '2', '2', '2', '2', '2', ' ',        '5', '5', '5', '5', '5', '5', '5', '5', ' ', '8', '8', '8', '8',        '8', '8', '8', '8', ' ', '\n', ' ', 'i', 'i', 'i', 'i', 'i', 'i',        'i', 'i', ' ', 'e', 'e', 'e', 'e', 'e', 'e', 'e', 'e', ' ', 'b',        'b', 'b', 'b', 'b', 'b', 'b', 'b', ' ', '2', '2', '2', '2', '2',        '2', '2', '2', ' ', '5', '5', '5', '5', '5', '5', '5', '5', ' ',        '9', '9', '9', '9', '9', '9', '9', '9', ' ', '\n', ' ', 'i', 'i',        'i', 'i', 'i', 'i', 'i', 'i', ' ', 'f', 'f', 'f', 'f', 'f', 'f',        'f', 'f', ' ', 'b', 'b', 'b', 'b', 'b', 'b', 'b', 'b', ' ', '2',        '2', '2', '2', '2', '2', '2', '2', ' ', '6', '6', '6', '6', '6',        '6', '6', '6', ' ', '9', '9', '9', '9', '9', '9', '9', '9', ' ',        '\n', ' ', 'i', 'i', 'i', 'i', 'i', 'i', 'i', 'i', ' ', 'f', 'f',        'f', 'f', 'f', 'f', 'f', 'f', ' ', 'c', 'c', 'c', 'c', 'c', 'c',        'c', 'c', ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ', '6',        '6', '6', '6', '6', '6', '6', '6', ' ', '9', '9', '9', '9', '9',        '9', '9', '9', ' ', '\n', ' ', 'i', 'i', 'i', 'i', 'i', 'i', 'i',        'i', ' ', 'f', 'f', 'f', 'f', 'f', 'f', 'f', 'f', ' ', 'c', 'c',        'c', 'c', 'c', 'c', 'c', 'c', ' ', '3', '3', '3', '3', '3', '3',        '3', '3', ' ', '6', '6', '6', '6', '6', '6', '6', '6', ' ', '9',        '9', '9', '9', '9', '9', '9', '9', ' ', '\n', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', 'f', 'f', 'f', 'f', 'f', 'f', 'f',        'f', ' ', 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c', ' ', '3', '3',        '3', '3', '3', '3', '3', '3', ' ', '6', '6', '6', '6', '6', '6',        '6', '6', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\n',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', 'c', 'c', 'c', 'c', 'c', 'c', 'c',        'c', ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', '\n'], dtype='<U1')
x_mask = array([' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', '0', '1', '2', '3', '4', '5',        '6', '7', ' ', '\n', ' ', '0', '1', '2', '3', '4', '5', '6', '7',        ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1',        '2', '3', '4', '5', '6', '7', ' ', '\n', ' ', '0', '1', '2', '3',        '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7',        ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2',        '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6',        '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '\n', ' ',        '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3',        '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7',        ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2',        '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6',        '7', ' ', '\n', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ',        '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3',        '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7',        ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2',        '3', '4', '5', '6', '7', ' ', '\n', ' ', '0', '1', '2', '3', '4',        '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ',        '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3',        '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7',        ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '\n', ' ', '0',        '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4',        '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ',        '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3',        '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7',        ' ', '\n', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0',        '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4',        '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ',        '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3',        '4', '5', '6', '7', ' ', '\n', ' ', '0', '1', '2', '3', '4', '5',        '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0',        '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4',        '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ',        '0', '1', '2', '3', '4', '5', '6', '7', ' ', '\n', ' ', '0', '1',        '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5',        '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0',        '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4',        '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ',        '\n', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1',        '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5',        '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0',        '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4',        '5', '6', '7', ' ', '\n', ' ', '0', '1', '2', '3', '4', '5', '6',        '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1',        '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5',        '6', '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0',        '1', '2', '3', '4', '5', '6', '7', ' ', '\n', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', '0', '1', '2', '3', '4', '5', '6',        '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', '0', '1',        '2', '3', '4', '5', '6', '7', ' ', '0', '1', '2', '3', '4', '5',        '6', '7', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\n',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', '0', '1', '2', '3', '4', '5', '6',        '7', ' ', '0', '1', '2', '3', '4', '5', '6', '7', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', '\n'], dtype='<U1')
x_range = ['0', '1', '2', '3', '4', '5', '6', '7']
y_mask = array([' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', '3', '3', '3', '3', '3', '3',        '3', '3', ' ', '\n', ' ', '2', '2', '2', '2', '2', '2', '2', '2',        ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ', '2', '2',        '2', '2', '2', '2', '2', '2', ' ', '\n', ' ', '1', '1', '1', '1',        '1', '1', '1', '1', ' ', '2', '2', '2', '2', '2', '2', '2', '2',        ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ', '3', '3', '3',        '3', '3', '3', '3', '3', ' ', '2', '2', '2', '2', '2', '2', '2',        '2', ' ', '1', '1', '1', '1', '1', '1', '1', '1', ' ', '\n', ' ',        '0', '0', '0', '0', '0', '0', '0', '0', ' ', '1', '1', '1', '1',        '1', '1', '1', '1', ' ', '2', '2', '2', '2', '2', '2', '2', '2',        ' ', '2', '2', '2', '2', '2', '2', '2', '2', ' ', '1', '1', '1',        '1', '1', '1', '1', '1', ' ', '0', '0', '0', '0', '0', '0', '0',        '0', ' ', '\n', ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ',        '0', '0', '0', '0', '0', '0', '0', '0', ' ', '1', '1', '1', '1',        '1', '1', '1', '1', ' ', '1', '1', '1', '1', '1', '1', '1', '1',        ' ', '0', '0', '0', '0', '0', '0', '0', '0', ' ', '3', '3', '3',        '3', '3', '3', '3', '3', ' ', '\n', ' ', '2', '2', '2', '2', '2',        '2', '2', '2', ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ',        '0', '0', '0', '0', '0', '0', '0', '0', ' ', '0', '0', '0', '0',        '0', '0', '0', '0', ' ', '3', '3', '3', '3', '3', '3', '3', '3',        ' ', '2', '2', '2', '2', '2', '2', '2', '2', ' ', '\n', ' ', '1',        '1', '1', '1', '1', '1', '1', '1', ' ', '2', '2', '2', '2', '2',        '2', '2', '2', ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ',        '3', '3', '3', '3', '3', '3', '3', '3', ' ', '2', '2', '2', '2',        '2', '2', '2', '2', ' ', '1', '1', '1', '1', '1', '1', '1', '1',        ' ', '\n', ' ', '0', '0', '0', '0', '0', '0', '0', '0', ' ', '1',        '1', '1', '1', '1', '1', '1', '1', ' ', '2', '2', '2', '2', '2',        '2', '2', '2', ' ', '2', '2', '2', '2', '2', '2', '2', '2', ' ',        '1', '1', '1', '1', '1', '1', '1', '1', ' ', '0', '0', '0', '0',        '0', '0', '0', '0', ' ', '\n', ' ', '3', '3', '3', '3', '3', '3',        '3', '3', ' ', '0', '0', '0', '0', '0', '0', '0', '0', ' ', '1',        '1', '1', '1', '1', '1', '1', '1', ' ', '1', '1', '1', '1', '1',        '1', '1', '1', ' ', '0', '0', '0', '0', '0', '0', '0', '0', ' ',        '3', '3', '3', '3', '3', '3', '3', '3', ' ', '\n', ' ', '2', '2',        '2', '2', '2', '2', '2', '2', ' ', '3', '3', '3', '3', '3', '3',        '3', '3', ' ', '0', '0', '0', '0', '0', '0', '0', '0', ' ', '0',        '0', '0', '0', '0', '0', '0', '0', ' ', '3', '3', '3', '3', '3',        '3', '3', '3', ' ', '2', '2', '2', '2', '2', '2', '2', '2', ' ',        '\n', ' ', '1', '1', '1', '1', '1', '1', '1', '1', ' ', '2', '2',        '2', '2', '2', '2', '2', '2', ' ', '3', '3', '3', '3', '3', '3',        '3', '3', ' ', '3', '3', '3', '3', '3', '3', '3', '3', ' ', '2',        '2', '2', '2', '2', '2', '2', '2', ' ', '1', '1', '1', '1', '1',        '1', '1', '1', ' ', '\n', ' ', '0', '0', '0', '0', '0', '0', '0',        '0', ' ', '1', '1', '1', '1', '1', '1', '1', '1', ' ', '2', '2',        '2', '2', '2', '2', '2', '2', ' ', '2', '2', '2', '2', '2', '2',        '2', '2', ' ', '1', '1', '1', '1', '1', '1', '1', '1', ' ', '0',        '0', '0', '0', '0', '0', '0', '0', ' ', '\n', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', '0', '0', '0', '0', '0', '0', '0',        '0', ' ', '1', '1', '1', '1', '1', '1', '1', '1', ' ', '1', '1',        '1', '1', '1', '1', '1', '1', ' ', '0', '0', '0', '0', '0', '0',        '0', '0', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\n',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', '0', '0', '0', '0', '0', '0', '0',        '0', ' ', '0', '0', '0', '0', '0', '0', '0', '0', ' ', ' ', ' ',        ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',        ' ', ' ', ' ', '\n'], dtype='<U1')
y_range = ['0', '0', '1', '1', '2', '2', '3', '3']
rosalia.plots.main_offender_find_fraction_of_map(mainoff_name, catalog)
rosalia.plots.make_stars_around_plot(flt_name, catalog, astropywcs_list, RA_TARG, DEC_TARG, radius=0.6, output_name=None, figsize=(10, 7))
rosalia.plots.make_stray_plot(input_name, ext, mode='normal', catalog=None, vmin=None, vmax=None, color_label='Surface brightness (mag arcsec$^{-2}$)', cmap='RdYlBu', output_name=None, figsize=(10, 7), mu_vmin=None, mu_vmax=None)
rosalia.plots.plot_ndi_main_offenders(input_name, scaled_main_off, catalog, ndi_level, figsize=(10, 7))
rosalia.plots.plot_stars_around(ax, catalog, max_plot_size=50, min_plot_size=5, alpha=0.2)
rosalia.plots.plot_stray_and_ndi_map(stray_name, star_catalog, ra_point, dec_point, pa_point, ndi_name, stray_scale_factor, vmin, vmax, ndi_linthresh, marker='*', edgecolor='black', color='red', s=100)
rosalia.plots.print_ascii_focal_plane(x, y, SCA)
class rosalia.plots.style

Bases: object

BLACK = '\x1b[30m'
BLUE = '\x1b[34m'
CYAN = '\x1b[36m'
GREEN = '\x1b[32m'
MAGENTA = '\x1b[35m'
RED = '\x1b[31m'
RESET = '\x1b[0m'
UNDERLINE = '\x1b[4m'
WHITE = '\x1b[37m'
YELLOW = '\x1b[33m'

rosalia.psf module

rosalia.psf.append_empty_rows(dataframe, n)
rosalia.psf.astscript_psf_scale_factor(input_name, ra, dec, psf_name, clean=False, verbose=False)
rosalia.psf.astscript_psf_subtract(input_name, ext, ra, dec, scaling_factor, psf_name, clean=True)
rosalia.psf.astscript_radial_profile(input_name, ra, dec, rmax, clean=False, verbose=False)
rosalia.psf.find_SCA_for_a_target(file_name, ra, dec, include_border=True)
rosalia.psf.find_stars_inside_detector(input_name, g_mag_max=15, verbose=False)
rosalia.psf.gaia_find_stars_in_and_out(input_name, ext, lambda_ref, ra=None, dec=None, radius=0.1, g_mag_max=False, MJD=None, clean=True, verbose=False, gaia_query=False, match_inside_stars=False)
rosalia.psf.generate_star_stamps(hybrid_catalog, image_identity, verbose=False)
rosalia.psf.getWCS_galsim_dict_style(file_name)
rosalia.psf.get_hybrid_catalog(ra, dec, radius, lambda_ref, MJD, observer, g_mag_max=False, verbose=False, query_filename='default_query.dat')
rosalia.psf.identify_stars_in_out_field(data_shape, wcs, catalog, ra=None, dec=None, verbose=False)
rosalia.psf.measure_maxradii(input_name, ra, dec, rmax, saturation_level=None, clean=False, verbose=False, clean_profile=False)
rosalia.psf.psf_harvester_single_exposure(input_name, clean=True, verbose=False)
rosalia.psf.scale_and_subtract_stars(input_name, ext, exposure_identity, g_mag_max=False, clean=False, verbose=False)
rosalia.psf.scale_and_subtract_stars_single_image(input_name, ext, ra, dec, psf_name, clean=True, extrapolate=False, verbose=False)

rosalia.render module

rosalia.render.render_healpix_movie(healpix_list, outname, figsize=(20, 10), verbose=True)

rosalia.roman module

rosalia.roman.create_roman_dummy(point, date, band, PA=None, exptime=500, output='default_roman_dummy.fits')
rosalia.roman.fe2mag(fe, bandpass, sca)
rosalia.roman.get_subarray_locations(SCA, verbose=False)

This program estimates the locations on the SCA detector of the different subarrays used for NDI estimation. Since some SCAS are flipped, and the number of subarrays used for might be variable, it is better to estimate it case by case.

rosalia.roman.mag2fe(mag, bandpass, sca)
rosalia.roman.make_average_ndi_maps()
rosalia.roman.make_romanisim_dummy(name, ra, dec, pa, bandpass, date, catalog=None)
rosalia.roman.roman_WFI_NDI_estimator_direct(ra_stars, dec_stars, ra_point, dec_point, pa_point, SCA, level, X_label=None, Y_label=None, verbose=True)
rosalia.roman.roman_estimate_straylight_SCA(data_shape, wcs, SCA, filter_identity, ra_stars, dec_stars, irradiance_stars, cat_id, source_id, ra_point, dec_point, pa_point, verbose=False, dry_mode=False)

rosalia.sky module

rosalia.sky.correct_flat_sky(input_name, ext, overwrite=True, clean=True, verbose=False)
rosalia.sky.get_zodiacal_background(input_name=None, ext=None, exposure_identity=None, wavelength=None, telescope=None, instrument=None, detector=None, expstart=None, step=1000, zody_mode='zodipy', nbins_wavelength=20, obslocin=3, grid_method='random', output_units=None, verbose=False, interpolate=True)
rosalia.sky.gunagala_zody(ra, dec, wavelength, year, day)

This program makes use of the Gunagala Zodiacal model to estimate the Zodiacal light surface brightness in a given position, at a wavelength, day and year.

Input: ra = Right ascension (degrees) dec = Declination (degrees) wavelength = wavelength (micron) year = year of the observation day = day of the observation

Output: mu_zody = surface brightness in Jy arcsec-2

rosalia.sky.rebin(a, newshape)

Rebin an array to a new shape.

rosalia.sky.rebin_transmission_curve(filter_transmission_curve, nbins, verbose=False)
rosalia.sky.remove_zodiacal_light_acs(input_name, verbose=False)
rosalia.sky.zodipy_zody(ra, dec, wavelength, weights, expstart, obspos='earth')

This program makes use of the Zodipy Zodiacal model to estimate the Zodiacal light surface brightness in a given position, at a wavelength, day and year.

Input: ra = Right ascension (degrees) dec = Declination (degrees) wavelength = Wavelength (micron) weights = Transmission at the proper wavelength expstart = Modified Julian Day of the observation (MJD)

Output: mu_zody = surface brightness in Jy arcsec-2

rosalia.skysurf module

rosalia.skysurf.find_obsid_in_skysurf(obsid)
rosalia.skysurf.load_skysurf()
rosalia.skysurf.load_skysurf_filter(instrument, filter_hst)

rosalia.sso module

rosalia.sso.get_SS0s_loc_magnitude(observer, MJD, lambda_ref, verbose=False)
rosalia.sso.get_SSOs_ephemeris(observer, MJD)
rosalia.sso.get_ephemeris(observer, object, MJD)

rosalia.telescopes module

class rosalia.telescopes.ARRAKIHS

Bases: object

ARRAKIHS Telescope properties class

TELESCOP = 'ARRAKIHS'
TLE_exposure()
TLE_tuple()
fe2mu()
get_PSF()
get_canvas_shape()
get_filter(filter_name, verbose=False)
get_pixscale()
load_example_TLE()
make_dummy_exposure(dec, pa, outname)
mirror_radius = <Quantity 0.075 m>
modified_make_dummy_exposure(dec, pa, outname)
mu2fe()
old_make_dummy_exposure(dec, pa, outname)
class rosalia.telescopes.CSST

Bases: object

Chinese Space Station Telescope properties class

TELESCOP = 'CSST'
TLE_exposure()
TLE_tuple()
f()
fe2mu(instrument='MCI', filter_name='MCI.F630M', telescope='CSST', verbose=False)
filter_names = ['MCI.F275W', 'MCI.F336W', 'MCI.F375M', 'MCI.F450M', 'MCI.F500M', 'MCI.F630M', 'MCI.F763M', 'MCI.F845M', 'MCI.F960M']
get_PSF()
get_canvas_shape()
get_filter(filter_name, verbose=False)
get_physical_pixelsize()
get_pixscale()
load_example_TLE_CSST()
make_dummy_exposure(dec, pa, outname)
mirror_radius = <Quantity 1. m>
mu2fe(instrument='MCI', filter_name='MCI.F630M', telescope='CSST', verbose=False)
ndi_estimator(phi=None, wavelength=None, mode='legacy')

ndi_estimator estimates the NDI for a given angle theta (and optionally phi) and wavelength. It uses either the legacy values from Bely 2003 for the HST NDI or the Euclid NDI envelope depending on the mode selected. The function returns an interpolated NDI value for the given theta. Input parameters:

  • theta: The angle in degrees for which to estimate the NDI.

  • phi: (Optional) The azimuthal angle in degrees. Not used in the current implementation but can be included for future improvements.

  • wavelength: (Optional) The wavelength in microns

  • mode: A string that determines which NDI values to use. “legacy” uses the Bely 2003 values for HST, while “euclid” uses the Euclid NDI envelope.

Output:
  • f_NDI_interpolator(theta): The interpolated NDI value for the given theta.

old_make_dummy_exposure(dec, pa, outname, binning=8)
class rosalia.telescopes.Euclid

Bases: object

Euclid Telescope properties class

TELESCOP = 'Euclid'
mirror_radius = <Quantity 0.6 m>
class rosalia.telescopes.Hubble

Bases: object

Hubble Space Telescope properties class

TELESCOP = 'HST'
TLE_exposure()
f()
fe2mu()
get_HST_ACS_psf(chip='WFC1', xy=[2000, 1000], output=None, verbose=1)
get_PSF()
get_canvas_shape()
get_filter(filter_name, verbose=False)
get_location(pov='@sun')
get_physical_pixelsize()
get_pixscale()
load_HST_TLEs()

Loads the history of TLEs for Hubble Space Telescope. It return a list of Skyfield EarthSatellite objects TLE. Current version: HST_TLE_history_sat000020580.txt - From launch (1990) - up to June 19, 2024.

load_TLE_tuple()
make_dummy_exposure(dec, pa, outname)
mirror_radius = <Quantity 1.2 m>
mu2fe()
ndi_estimator(phi=None, wavelength=None, mode='legacy')

ndi_estimator estimates the NDI for a given angle theta (and optionally phi) and wavelength. It uses either the legacy values from Bely 2003 for the HST NDI or the Euclid NDI envelope depending on the mode selected. The function returns an interpolated NDI value for the given theta. Input parameters:

  • theta: The angle in degrees for which to estimate the NDI.

  • phi: (Optional) The azimuthal angle in degrees. Not used in the current implementation but can be included for future improvements.

  • wavelength: (Optional) The wavelength in microns

  • mode: A string that determines which NDI values to use. “legacy” uses the Bely 2003 values for HST, while “euclid” uses the Euclid NDI envelope.

Output:
  • f_NDI_interpolator(theta): The interpolated NDI value for the given theta.

class rosalia.telescopes.MESSIER

Bases: object

MESSIES Telescope properties class

TELESCOP = 'MESSIER'
TLE_exposure()
TLE_tuple()
fe2mu()
get_PSF()
get_canvas_shape()
get_filter(verbose=False)

Filter w1 wc w2 N200 180.0 200.0 220.0 M200 158.0 200.0 242.0 M310 255.0 310.0 365.0 M480 375.0 480.0 585.0 M690 590.0 690.0 790.0 M890 800.0 890.0 980.0

get_pixscale()
load_example_TLE()
make_dummy_exposure(dec, pa, outname)
mirror_radius = <Quantity 0.25 m>
mu2fe()
class rosalia.telescopes.Passbands

Bases: object

class Gaia

Bases: object

class bp

Bases: object

filter_width = <Quantity 2333.06 Angstrom>
lambda_ref = <Quantity 5124.2 Angstrom>
class g

Bases: object

filter_width = <Quantity 4203.61 Angstrom>
lambda_ref = <Quantity 6251.5 Angstrom>
class rp

Bases: object

filter_width = <Quantity 2842.11 Angstrom>
lambda_ref = <Quantity 7829.65 Angstrom>
class TwoMASS

Bases: object

class H

Bases: object

filter_width = <Quantity 2509.4 Angstrom>
lambda_ref = <Quantity 16620. Angstrom>
class J

Bases: object

filter_width = <Quantity 1624.32 Angstrom>
lambda_ref = <Quantity 12350. Angstrom>
class Ks

Bases: object

filter_width = <Quantity 2618.87 Angstrom>
lambda_ref = <Quantity 21590. Angstrom>
class WISE

Bases: object

class W1

Bases: object

filter_width = <Quantity 6626.42 Angstrom>
lambda_ref = <Quantity 33526. Angstrom>
class W2

Bases: object

filter_width = <Quantity 10422.66 Angstrom>
lambda_ref = <Quantity 46028. Angstrom>
class W3

Bases: object

filter_width = <Quantity 55055.23 Angstrom>
lambda_ref = <Quantity 115608. Angstrom>
class W4

Bases: object

filter_width = <Quantity 41016.8 Angstrom>
lambda_ref = <Quantity 220883. Angstrom>
class rosalia.telescopes.Roman

Bases: object

Nancy Grace Space Telescope properties class

DEPRECATED_get_bestPA(dec, mjd)

get_bestPA calculates the best position angle for Roman’s WFI given the target coordinates and the time of observation. It uses the galsim.roman.bestPA function to compute the optimal position angle that gets the Sun on the sunshield. The function takes in the right ascension (ra), declination (dec), and modified Julian date (mjd) as inputs and returns the best position angle in degrees.

Input parameters: - ra: Right ascension of the target in degrees. - dec: Declination of the target in degrees. - mjd: Modified Julian Date of the observation.

Output: - WFI_PA: The best position angle for Roman’s WFI in degrees.

TELESCOP = 'Roman'
WFI_SCAs = array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,        18])
f()
find_wfi_center_for_offset_target(dec_target, mjd, dX, dY, PA_wfi=None, verbose=False)
get_Gennaro_bestPA(dec, mjd)
get_bestPA(dec, mjd)
get_filter(filter_name, verbose=False)
get_location(pov='@sun')
get_physical_pixelsize()
get_pixscale()
get_psf(detector, filter_name)
mirror_radius = <Quantity 1.2 m>
ndi_estimator(phi=None, wavelength=None, mode='legacy')

ndi_estimator estimates the NDI for a given angle theta (and optionally phi) and wavelength. It uses either the legacy values from Bely 2003 for the HST NDI or the Euclid NDI envelope depending on the mode selected. The function returns an interpolated NDI value for the given theta. Input parameters:

  • theta: The angle in degrees for which to estimate the NDI.

  • phi: (Optional) The azimuthal angle in degrees. Not used in the current implementation but can be included for future improvements.

  • wavelength: (Optional) The wavelength in microns

  • mode: A string that determines which NDI values to use. “legacy” uses the Bely 2003 values for HST, while “euclid” uses the Euclid NDI envelope.

Output:
  • f_NDI_interpolator(theta): The interpolated NDI value for the given theta.

stpsf_get_psf(detector, filter_name, fov_pixels=1024, oversample=1)
class rosalia.telescopes.SPHEREx

Bases: object

SPHEREx Telescope properties class

TELESCOP = 'SPHEREx'
TLE_exposure()
TLE_tuple()
fe2mu()
get_PSF()
get_canvas_shape()
get_pixscale()
load_example_TLE()
make_dummy_exposure(dec, pa, outname)
mirror_radius = <Quantity 0.1 m>
mu2fe()
old_make_dummy_exposure(dec, pa, outname)
rosalia.telescopes.find_closest_TLE(epoch, TLE_history)
rosalia.telescopes.find_filter_in_svo(wavelength, telescope, instrument, detector, verbose=False)
rosalia.telescopes.get_filter(telescope, instrument, detector, filter_name, verbose=False)
rosalia.telescopes.ndi_estimator(theta, phi=None, wavelength=None, mode='legacy')

ndi_estimator estimates the NDI for a given angle theta (and optionally phi) and wavelength. It uses either the legacy values from Bely 2003 for the HST NDI or the Euclid NDI envelope depending on the mode selected. The function returns an interpolated NDI value for the given theta. Input parameters:

  • theta: The angle in degrees for which to estimate the NDI.

  • phi: (Optional) The azimuthal angle in degrees. Not used in the current implementation but can be included for future improvements.

  • wavelength: (Optional) The wavelength in microns

  • mode: A string that determines which NDI values to use. “legacy” uses the Bely 2003 values for HST, while “euclid” uses the Euclid NDI envelope.

Output:
  • f_NDI_interpolator(theta): The interpolated NDI value for the given theta.

rosalia.telescopes.telescope_class_finder(telescope)

rosalia.tests module

rosalia.tests.test_fe2mu_mu2fe()
rosalia.tests.test_magnitude_conversion_gaia()
rosalia.tests.test_photometry_superstars()

rosalia.utils module

rosalia.utils.MJysr_to_jyarcsec2(flux_mjy_sr)
rosalia.utils.angular_distance(ra1, dec1, ra2, dec2)

Einsum version of the angular separation function by Astropy einsum_angular_distance_harversine v1: October 17, 2024 - Fastest version compared against numba, or astropy.

rosalia.utils.check_file_integrity(filenames)
rosalia.utils.check_fits_integrity(input)
rosalia.utils.check_number_of_extensions(input_name, expected_next, verbose=False)
rosalia.utils.circle_around_position(ra, dec, radius, npoints=200)
rosalia.utils.circular_hist(ax, x, bins=16, density=True, offset=0, gaps=True, color='dodgerblue', edgecolor='C0')

Produce a circular histogram of angles on ax.

Parameters

axmatplotlib.axes._subplots.PolarAxesSubplot

axis instance created with subplot_kw=dict(projection=’polar’).

xarray

Angles to plot, expected in units of radians.

binsint, optional

Defines the number of equal-width bins in the range. The default is 16.

densitybool, optional

If True plot frequency proportional to area. If False plot frequency proportional to radius. The default is True.

offsetfloat, optional

Sets the offset for the location of the 0 direction in units of radians. The default is 0.

gapsbool, optional

Whether to allow gaps between bins. When gaps = False the bins are forced to partition the entire [-pi, pi] range. The default is True.

Returns

narray or list of arrays

The number of values in each bin.

binsarray

The edges of the bins.

patches.BarContainer or list of a single .Polygon

Container of individual artists used to create the histogram or list of such containers if there are multiple input datasets.

rosalia.utils.convert_ASDF_to_FITS(asdf_list, output)
rosalia.utils.create_angle_mask(xsize, ysize, q, theta, center=None, radius=None, pitch=90)
rosalia.utils.create_custom_wcs(crpix, crval, cdelt, crota=[0, 0], projection='TAN')
rosalia.utils.create_dummy_exposure(telescope, instrument, detector, exposure_params, binning=1, dummy_name='dummy.fits')
rosalia.utils.create_dummy_image_with_wcs(ra_cen, dec_cen, ra_size, dec_size, pixscale, outname='default_dummy.fits')
rosalia.utils.create_radial_mask(xsize, ysize, q=1, theta=0, center=None, radius=None)
rosalia.utils.delta_angular_separation(ra, dec)
rosalia.utils.detect_sci_extensions(input_name)
rosalia.utils.divide_array_in_chunks(array, chunk_size)
rosalia.utils.download_file(url, verbose=True)
Downloads the file described as an url address.
param str url:

Url of the file to be downloaded

returns:

Local path of the downloaded file

rtype:

str

rosalia.utils.ds9tomask(fname, nx, ny, outname)
rosalia.utils.erwinspacing(minimum, number, rate=1.03, mode='int')
rosalia.utils.execute_cmd(cmd, verbose=False)

Executes a shell command line. :param cmd: Command line to be executed :type cmd: str :return: Shell output :rtype: str

rosalia.utils.exposure_inspector(input_name, verbose=False, lite=False)

exposure_inspector: Inspects and returns critical information about the contents of an exposure telescope. :param input_name: Exposure file to be inspected. It can be a string with the name of the file, a list of files, or a pattern with *. :type input_name: str, list :return: Exposure identity - A dictionary with critical information about the exposure, including pointing (right ascension and declination), position angle, telescope, instrument, detector, filter, and a WCS (Astropy and GWCS). :rtype: dict, pd.DataFrame

rosalia.utils.exposure_inspector_asdf(input_name, verbose=False, lite=False)
rosalia.utils.exposure_inspector_fits(input_name, verbose=False, lite=False)
rosalia.utils.exposure_inspector_single(input_name, verbose=False, lite=False)

Inspects and returns critical information about the contents of a telescope exposure, stored as a FITS or ADSF file.

Parameters:

input_name – Exposure file to be inspected

Returns:

Exposure identity - A dictionary with critical information about the exposure, including pointing (right ascension and declination), position angle, telescope, instrument, detector, filter, and a WCS (Astropy and GWCS).

Return type:

dict

rosalia.utils.find_SCA_EXTNAME(EXTNAME)
rosalia.utils.find_max_angular_size_of_image(wcs, ra_cen=None, dec_cen=None)

Returns the maximum angular extension of an image.

Parameters:
  • data (numpy.ndarray)

  • wcs (astropy.wcs.wcs.WCS)

Returns:

float:

The maximum angular extension of the image in sky coordinates in degrees.

rosalia.utils.find_nearest_index(array, value)
rosalia.utils.find_subposition_EXTNAME(EXTNAME)
rosalia.utils.flambda_to_fnu(flambda, wavelength)
rosalia.utils.fnu_to_flambda(fnu, wavelength)
rosalia.utils.generate_image_interpolator(data, x=None, y=None)
rosalia.utils.get_astropywcs_info_from_sciexts(filename, sciexts)
rosalia.utils.get_data_and_wcs(input_name, ext)

Opens a fits file and returns the data and wcs at a certain extension.

Parameters:
  • input_name (str)

  • ext (int)

Returns:

list:

A two element list. [data (numpy.ndarray), wcs (astropy.wcs.wcs.WCS)]

rosalia.utils.get_keys_from_header(fits_list, index, ext=0)
rosalia.utils.get_parameters_list(fits_list, index, ext=0)
rosalia.utils.get_pixscale(fits_name, ext)
rosalia.utils.great_circle_ra_dec_shift(theta, phi)

Estimates the new coordinates (ra2, dec2) after moving an angular distance theta (radial direction) in the phi direction (0 deg, North, counterclockwise) along a Great Circle from the Equator (ra=0, dec=0) Adapted from Great Circle navigation: https://en.wikipedia.org/wiki/Great-circle_navigation

Parameters:
  • theta (np.ndarray or float in degrees)

  • phi (np.ndarray or float in degrees)

Returns:

radec_2 :dict: Contains the new coordinates “ra”, “dec” in degrees.

rosalia.utils.hp_resol2nside(resolution)

This program converts a resolution in degrees to the nside parameter of healpix. :param resolution: Resolution in degrees (astropy units). :type resolution: astropy.units.Unit :return: nside parameter of healpix :rtype: int

rosalia.utils.interpolate_location_in_fits(fits_name, ext, ra, dec)

This program interpolates the value of a FITS file at the location of the input coordinates (ra, dec). The FITS file requires to have a WCS in the correct EXT, and the coordinates are transformed to pixel coordinates using the WCS. The interpolation is done using a linear interpolation in the grid of the FITS file. The output is the interpolated value at the input coordinates.

Parameters:
  • fits_name (str) – Name of the FITS file to be interpolated

  • ext (int) – Extension of the FITS file to be interpolated

  • ra (float) – Right ascension of the location to be interpolated

  • dec (float) – Declination of the location to be interpolated

Returns:

Interpolated value at the input coordinates

Return type:

float

rosalia.utils.load_dict(input_name, verbose=False)
Load a python object using pickle.
param str input_name:

Name of the file to be loaded

returns:

Python object stored in the file

rtype:

Python object

rosalia.utils.make_ds9_region(ra, dec, output='ds9.reg')
rosalia.utils.make_profile(image, radial_mask=None, ext=None, ra_cen=None, dec_cen=None, xcen=None, ycen=None, rbins=None, pixscale=1, nbins=100, nsimul=100, q=1, theta=0)
rosalia.utils.mask_sources(file_name, ext)
rosalia.utils.measure_maglim(mu_sky, instrument, filter_name, telescope, exptime, sigma=3, box=10, verbose=False)

Measure the limiting magnitude of an image given the sky background level, the instrument, filter, telescope and exposure time.

Parameters

mu_skyfloat

Sky background level in AB magnitudes per square arcsecond.

instrumentstr

Name of the instrument used for the observation.

filter_namestr

Name of the filter used for the observation.

telescopestr

Name of the telescope used for the observation.

exptimefloat

Exposure time in seconds.

sigmafloat, optional

Sigma level for the detection. Default is 3.

boxfloat, optional

Size of the box in arcseconds for the detection. Default is 10.

verbosebool, optional

If True, print detailed information. Default is False.

Returns

mu_limfloat

Limiting surface brightness in AB magnitudes per square arcsecond for the specified sigma detection in the specified box size (default is 3-sigma in a 10x10 arcsecond area).

rosalia.utils.modify_keyword_hdr(input_name, ext, keyword, mode, verbose=True)
rosalia.utils.position_angle(ra1, dec1, ra2, dec2)

Einsum version of the position angle function by Astropy einsum_angular_distance_harversine v1: October 17, 2024

rosalia.utils.radec_to_xy(ra, dec, fits_name, ext)
rosalia.utils.read_ds9reg(fname)
rosalia.utils.reproject_roman_wfi_fits(input_name, input_ext, reference_name, reference_ext)
rosalia.utils.run_basic_astrodrizzle(file_name)
rosalia.utils.run_basic_noisechisel(file_name, ext)
rosalia.utils.run_swarp(pattern, outname, scale=1, coveredfrac=1, resample=True, verbose=False)

run_swarp: This program runs SWARP on the input pattern of files, and generates a mosaic with the output name specified in outname. The pattern can be a string with the name of the file, a list of files, or a pattern with *. The output mosaic will be saved as outname, and if scale is different from 1, a scaled version of the mosaic will be saved as outname with the suffix “_scaled.fits”.

Parameters:
  • pattern (str, list) – Pattern of files to be mosaicked. It can be a string with the name of the file, a list of files, or a pattern with *.

  • outname (str) – Name of the output mosaic file. It should end with .fits

  • scale (float) – Scale factor for the output mosaic. If scale is different from 1, a scaled version of the mosaic will be saved as outname with the suffix “_scaled.fits”. The scale factor is applied to the pixel scale of the mosaic, so that the output mosaic will have a pixel scale that is scale times the original pixel scale. For example, if scale=0.1, the output mosaic will have a pixel scale that is 10 times the original pixel scale, and the output mosaic will be 10 times smaller in size than the original mosaic. The default value is 1 (no scaling).

  • coveredfrac (float) – Fraction of the mosaic that must be covered by input images. The default value is 1 (all pixels must be covered).

  • verbose (bool) – If True, print verbose output. The default value is False.

Returns:

List with the names of the output mosaic files. The first element is the name of the mosaic with the original pixel scale, and the second element is the name of the mosaic with the scaled pixel scale (if scale is different from 1). If scale is 1, the second element will be None.

Return type:

list

rosalia.utils.save_dict(dictionary, input_name, verbose=False)
Save a python object using pickle.
param Python object dictionary:

Any type of python object

returns:

Input python object

rtype:

Python object

rosalia.utils.save_fits(array, name, header=None, extname=None, overwrite=True, output_verify='silentfix')
rosalia.utils.separation_and_position_angle(ra1, dec1, ra2, dec2)

Einsum version of the angular separation function by Astropy einsum_angular_distance_harversine v1: October 17, 2024 - Fastest version compared against numba, or astropy.

rosalia.utils.sphere_dist(ra1, dec1, ra2, dec2)

A faster separation calculator than astropy solution. # https://stackoverflow.com/questions/71506875/faster-alternative-to-skycoord-separation

Haversine formula for angular distance on a sphere: more stable at poles. This version uses arctan instead of arcsin and thus does better with sign conventions. This uses numexpr to speed expression evaluation by a factor of 2 to 3.

Parameters:
  • ra1 – first RA (deg)

  • dec1 – first Dec (deg)

  • ra2 – second RA (deg)

  • dec2 – second Dec (deg)

Returns:

angular separation distance (deg)

rosalia.utils.thetaphi_2_radec(theta, phi)
rosalia.utils.write_parameters_list(fits_list, index, value, ext=0)
rosalia.utils.xy_to_radec(x, y, fits_name, ext)

Module contents

ROSALIA: ROman Sky Analyst for Low surface brightness Imaging & Astronomy