SkyModel Class

SkyModel is the main user class. It is a container for point source and diffuse models that can be interacted with directly and it provides import and export functionality.

class pyradiosky.SkyModel(name=None, ra=None, dec=None, stokes=None, spectral_type=None, freq_array=None, lon=None, lat=None, gl=None, gb=None, frame=None, reference_frequency=None, spectral_index=None, component_type=None, nside=None, hpx_inds=None, stokes_error=None, hpx_order=None, extended_model_group=None, beam_amp=None, history='', filename=None)[source]

Object to hold point source and diffuse models.

Defines a set of components at given ICRS ra/dec coordinates, with flux densities defined by stokes parameters.

Flux densities defined are by stokes parameters. The attribute Ncomponents gives the number of source components.

Contains methods to:
  • Read and write different catalog formats.

  • Calculate source positions.

  • Calculate local coherency matrix in a local topocentric frame.

Parameters
  • name (array_like of str) – Unique identifier for each source component, shape (Ncomponents,). Not used if nside is set.

  • lon (astropy.Longitude) – Source longitude in frame specified by keyword frame, shape (Ncomponents,).

  • lat (astropy.Latitude) – Source latitude in frame specified by keyword frame, shape (Ncomponents,).

  • ra (astropy.Longitude) – source RA in J2000 (or ICRS) coordinates, shape (Ncomponents,).

  • dec (astropy.Latitude) – source Dec in J2000 (or ICRS) coordinates, shape (Ncomponents,).

  • gl (astropy.Longitude) – source longitude in Galactic coordinates, shape (Ncomponents,).

  • gb (astropy.Latitude) – source latitude in Galactic coordinates, shape (Ncomponents,).

  • frame (str) – Name of coordinates frame of source positions. If ra/dec or gl/gb are provided, this will be set to icrs or galactic by default. Must be interpretable by astropy.coordinates.frame_transform_graph.lookup_name(). Required if keywords lon and lat are used.

  • stokes (astropy.Quantity or array_like of float (Deprecated)) – The source flux, shape (4, Nfreqs, Ncomponents). The first axis indexes the polarization as [I, Q, U, V].

  • spectral_type (str) – Indicates how fluxes should be calculated at each frequency.

    Options:

    • ‘flat’ : Flat spectrum.

    • ‘full’ : Flux is defined by a saved value at each frequency.

    • ‘subband’ : Flux is given at a set of band centers.

    • ‘spectral_index’ : Flux is given at a reference frequency.

  • freq_array (astropy.Quantity) – Array of frequencies that fluxes are provided for, shape (Nfreqs,).

  • reference_frequency (astropy.Quantity) – Reference frequencies of flux values, shape (Ncomponents,).

  • spectral_index (array_like of float) – Spectral index of each source, shape (Ncomponents). None if spectral_type is not ‘spectral_index’.

  • component_type (str) – Component type, either ‘point’ or ‘healpix’. If this is not set, the type is inferred from whether nside is set.

  • nside (int) – nside parameter for HEALPix maps.

  • hpx_inds (array_like of int) – Indices for HEALPix maps, only used if nside is set.

  • hpx_order (str) – For HEALPix maps, pixel ordering parameter. Can be “ring” or “nested”. Defaults to “ring” if unset in init keywords.

  • extended_model_group (array_like of str) – Identifier that groups components of an extended source model. Empty string for point sources, shape (Ncomponents,).

  • beam_amp (array_like of float) – Beam amplitude at the source position, shape (4, Nfreqs, Ncomponents). 4 element vector corresponds to [XX, YY, XY, YX] instrumental polarizations.

  • history (str) – History to add to object.

  • filename (str or list of str) – Base file name (not the whole path) or list of base file names for input data to track on the object.

set_spectral_type_params(spectral_type)[source]

Set parameters depending on spectral_type.

Deprecated, use _set_spectral_type_params

property ncomponent_length_params

Iterate over ncomponent length paramters.

clear_time_position_specific_params()[source]

Set parameters which are time & position specific to None.

check(check_extra=True, run_check_acceptability=True)[source]

Check that all required parameters are set reasonably.

Check that required parameters exist and have appropriate shapes. Optionally check if the values are acceptable.

Parameters
  • check_extra (bool) – Option to check optional parameters as well as required ones.

  • run_check_acceptability (bool) – Option to check if values in required parameters are acceptable.

copy()[source]

Overload this method to filter ra/dec warnings that shouldn’t be issued.

transform_to(frame)[source]

Transform to a difference coordinate frame using underlying Astropy function.

This function is a thin wrapper on astropy.coordinates.SkyCoord.transform_to please refer to that function for full documentation.

Parameters

frame (str, BaseCoordinateFrame class or instance.) – The frame to transform this coordinate into. Currently frame must be one of [“galactic”, “icrs”].

healpix_interp_transform(frame, full_sky=False, inplace=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Transform a HEALPix map to a new frame and interp to new pixel centers.

This method is only available for a healpix type sky model. Computes the pixel centers for a HEALPix map in the new frame, then interpolates the old map using astropy_healpix.interpolate_bilinear_skycoord.

Conversion with this method may take some time as it must iterate over every frequency and stokes parameter individually.

Currently no polarization fixing is performed by this method. As a result, it does not support transformations for polarized catalogs since this would induce a Q <–> U rotation.

Current implementation is equal to using a healpy.Rotator class to 1 part in 10^-5 (e.g numpy.allclose(healpy_rotated_map, interpolate_bilinear_skycoord, rtol=1e-5) is True).

Parameters
  • frame (str, BaseCoordinateFrame class or instance.) – The frame to transform this coordinate into. Currently frame must be one of [“galactic”, “icrs”].

  • full_sky (bool) – When True returns a full sky catalog even when some pixels are zero. Defaults to False.

  • inplace (bool) – Option to do the change in place on the object rather than return a new object. Default to True

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

kelvin_to_jansky()[source]

Apply a conversion to stokes from K-based units to Jy-based units.

No conversion is applied if stokes is already compatible with Jy (for point component_type) or Jy/sr (for healpix component_type).

jansky_to_kelvin()[source]

Apply a conversion to stokes from Jy-based units to K-based units.

No conversion is applied if stokes is already compatible with K sr (for point component_type) or K (for healpix component_type).

get_lon_lat()[source]

Retrieve ra and dec values for components.

This is mostly useful for healpix objects where the ra, dec values are not stored on the object (only the healpix inds are stored, which can be converted to ra/dec using this method).

healpix_to_point(to_jy=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Convert a healpix component_type object to a point component_type.

Multiply by the pixel area and optionally convert to Jy. This effectively treats diffuse pixels as unresolved point sources by integrating over the pixel area. Whether or not this is a good assumption depends on the nside and the resolution of the telescope, so it should be used with care, but it is provided here as a convenience.

Parameters
  • to_jy (bool) – Option to convert to Jy compatible units.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

point_to_healpix(to_k=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Convert a point component_type object to a healpix component_type.

Deprecated. Use assign_to_healpix to assign point components to a healpix grid. Use _point_to_healpix to undo a healpix_to_point conversion.

This method only works for objects that were originally healpix objects but were converted to point component type using healpix_to_point. This method undoes that conversion. It does NOT assign general point components to a healpix grid.

Requires that the hpx_inds and nside parameters are set on the object. Divide by the pixel area and optionally convert to K. This method is provided as a convenience for users to be able to undo the healpix_to_point method.

Parameters
  • to_k (bool) – Option to convert to K compatible units.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

assign_to_healpix(nside, order='ring', frame=None, to_k=True, full_sky=False, sort=True, inplace=False, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Assign point components to their nearest pixel in a healpix grid.

Also divide by the pixel area and optionally convert to K. This effectively converts point sources to diffuse pixels in a healpix map. Whether or not this is a good assumption depends on the nside and the resolution of the telescope, so it should be used with care, but it is provided here as a convenience.

Note that the time and position specific parameters [time, telescope_location, alt_az, pos_lmn and above_horizon] will be set to None as part of this method. They can be recalculated afterwards if desired using the update_positions method.

Parameters
  • nside (int) – nside of healpix map to convert to.

  • order (str) – Order convention of healpix map to convert to, either “ring” or “nested”.

  • to_k (bool) – Option to convert to K compatible units.

  • full_sky (bool) – Option to create a full sky healpix map with zeros in the stokes array for pixels with no sources assigned to them. If False only pixels with sources mapped to them will be included in the object.

  • sort (bool) – Option to sort the object in order of the healpix indicies.

  • frame (str, BaseCoordinateFrame class or instance.) – The frame of the input point source catalog. This is optional if the frame attribute is set on the SkyModel object. Currently frame must be one of [“galactic”, “icrs”].

  • inplace (bool) – Option to do the change in place on the object rather than return a new object.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

at_frequencies(freqs, inplace=True, freq_interp_kind='cubic', nan_handling='clip', run_check=True, atol=None)[source]

Evaluate the stokes array at the specified frequencies.

Produces a SkyModel object that is in the full frequency spectral type, based on the current spectral type: - full: Extract a subset of existing frequencies. - subband: Interpolate to new frequencies. - spectral_index: Evaluate at the new frequencies. - flat: Copy to new frequencies.

Parameters
  • freqs (Quantity) – Frequencies at which Stokes parameters will be evaluated.

  • inplace (bool) – If True, modify the current SkyModel object. Otherwise, returns a new instance. Default True.

  • freq_interp_kind (str or int) – Spline interpolation order, as can be understood by scipy.interpolate.interp1d. Only used if the spectral_type is “subband”.

  • nan_handling (str) – Choice of how to handle nans in the stokes when interpolating, only used if the spectral_type is “subband”. These are applied per source, so sources with no NaNs will not be affected by these choices. Options are “propagate” to set all the output stokes to NaN values if any of the input stokes values are NaN, “interp” to interpolate values using only the non-NaN values and to set any values that are outside the range of non-NaN values to NaN, and “clip” to interpolate values using only the non-NaN values and to set any values that are outside the range of non-NaN values to the nearest non-NaN value. For both “interp” and “clip”, any sources that have too few non-Nan values to use the chosen freq_interp_kind will be interpolated linearly and any sources that have all NaN values in the stokes array will have NaN values in the output stokes. Note that the detection of NaNs is done across all polarizations for each source, so all polarizations are evaluated using the same set of frequencies (so a NaN in one polarization at one frequency will cause that frequency to be excluded for the interpolation of all the polarizations on that source).

  • run_check (bool) – Run check on new SkyModel. Default True.

  • atol (Quantity) – Tolerance for frequency comparison. Defaults to 1 Hz.

update_positions(time, telescope_location)[source]

Calculate the altitude/azimuth positions for source components.

From alt/az, calculate direction cosines (lmn)

Doesn’t return anything but updates the following attributes in-place: * pos_lmn * alt_az * time

Parameters
  • time (astropy.Time) – Time to update positions for.

  • telescope_location (astropy.EarthLocation) – Telescope location to update positions for.

coherency_calc(deprecated_location=None)[source]

Calculate the local coherency in alt/az basis.

SkyModel.update_positions() must be run prior to this method.

The coherency is a 2x2 matrix giving electric field correlation in Jy. It’s specified on the object as a coherency in the ra/dec basis, but must be rotated into local alt/az.

Parameters

deprecated_location (astropy.EarthLocation) – This keyword is deprecated. It is preserved to maintain backwards compatibility and sets the EarthLocation on this SkyModel object.

Returns

array of float – local coherency in alt/az basis, shape (2, 2, Nfreqs, Ncomponents)

concat(other, clear_time_position=True, verbose_history=False, inplace=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Combine two SkyModel objects along source axis.

Parameters
  • other (SkyModel object) – Another SkyModel object which will be concatenated with self.

  • inplace (bool) – If True, overwrite self as we go, otherwise create a third object as the sum of the two.

  • clear_time_position (bool) – Option to clear time and position dependent parameters on both objects before concatenation. If False, time and position dependent parameters must match on both objects.

  • verbose_history (bool) – Option to allow more verbose history. If True and if the histories for the two objects are different, the combined object will keep all the history of both input objects (if many objects are combined in succession this can lead to very long histories). If False and if the histories for the two objects are different, the combined object will have the history of the first object and only the parts of the second object history that are unique (this is done word by word and can result in hard to interpret histories).

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after combining objects.

  • check_extra (bool) – Option to check optional parameters as well as required ones.

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after combining objects.

Raises

ValueError – If other is not a SkyModel object, self and other are not compatible or if data in self and other overlap. One way they can not be compatible is if they have different spectral_types.

select(component_inds=None, lat_range=None, lon_range=None, min_brightness=None, max_brightness=None, brightness_freq_range=None, inplace=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Downselect sources based on various criteria.

The history attribute on the object will be updated to identify the operations performed.

Parameters
  • component_inds (array_like of int) – Component indices to keep on the object.

  • lat_range (astropy.Latitude) – Range of Dec or galactic latitude, depending on the object frame attribute, to keep on the object, shape (2,).

  • lon_range (astropy.Longitude) – Range of RA or galactic longitude, depending on the object frame attribute, to keep on the object, shape (2,). If the second value is smaller than the first, the lons are treated as being wrapped around lon = 0, and the lons kept on the object will run from the larger value, through 0, and end at the smaller value.

  • min_brightness (astropy.Quantity) – Minimum brightness in stokes I to keep on object (implemented as a >= cut).

  • max_brightness (astropy.Quantity) – Maximum brightness in stokes I to keep on object (implemented as a <= cut).

  • brightness_freq_range (astropy.Quantity) – Frequency range over which the min and max brightness tests should be performed. Must be length 2. If None, use the range over which the object is defined.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

  • inplace (bool) – Option to perform the select directly on self or return a new SkyModel object with just the selected data (the default is True, meaning the select will be done on self).

calculate_rise_set_lsts(telescope_latitude, horizon_buffer=0.04364)[source]

Calculate the rise & set LSTs given a telescope latitude.

Sets the _rise_lst and _set_lst attributes on the object. These values can be NaNs for sources that never rise or never set. Call cut_nonrising() to remove sources that never rise from the object.

Parameters
  • telescope_latitude (Latitude object) – Latitude of telescope. Used to estimate rise/set lst.

  • horizon_buffer (float) – Angle buffer for rise/set LSTs in radians. Default is about 10 minutes of sky rotation. Components whose calculated altitude is less than horizon_buffer are excluded. Caution! The altitude calculation does not account for precession/nutation of the Earth. The buffer angle is needed to ensure that the horizon cut doesn’t exclude sources near but above the horizon. Since the cutoff is done using lst, and the lsts are calculated with astropy, the required buffer should _not_ drift with time since the J2000 epoch. The default buffer has been tested around julian date 2457458.0.

cut_nonrising(telescope_latitude, inplace=True, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Remove sources that will never rise.

Parameters
  • telescope_latitude (Latitude object) – Latitude of telescope.

  • inplace (bool) – Option to do the cuts on the object in place or to return a copy with the cuts applied.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

source_cuts(latitude_deg=None, horizon_buffer=0.04364, min_flux=None, max_flux=None, freq_range=None, run_check=True, check_extra=True, run_check_acceptability=True, inplace=True)[source]

Perform flux and horizon selections.

Parameters
  • latitude_deg (float) – Latitude of telescope in degrees. Used to estimate rise/set lst.

  • horizon_buffer (float) – Angle buffer for coarse horizon cut in radians. Default is about 10 minutes of sky rotation. Components whose calculated altitude is less than horizon_buffer are excluded. Caution! The altitude calculation does not account for precession/nutation of the Earth. The buffer angle is needed to ensure that the horizon cut doesn’t exclude sources near but above the horizon. Since the cutoff is done using lst, and the lsts are calculated with astropy, the required buffer should _not_ drift with time since the J2000 epoch. The default buffer has been tested around julian date 2457458.0.

  • min_flux (Quantity or float) – Minimum stokes I flux to select. If not a Quantity, assumed to be in Jy.

  • max_flux (Quantity or float) – Maximum stokes I flux to select. If not a Quantity, assumed to be in Jy.

  • freq_range (astropy.Quantity) – Frequency range over which the min and max flux tests should be performed. Must be length 2. If None, use the range over which the object is defined.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

  • inplace (bool) – Option to do the cuts on the object in place or to return a copy with the cuts applied.

to_recarray()[source]

Make a recarray of source components from this object.

Returns

catalog_table (recarray) – recarray equivalent to SkyModel data.

Notes

This stores all SkyModel data in a contiguous array that can be more easily handled with numpy.

classmethod from_recarray(recarray_in, history='', run_check=True, check_extra=True, run_check_acceptability=True)[source]

Initialize this object from a recarray.

Parameters
  • recarray_in (recarray) – recarray to turn into a SkyModel object.

  • history (str) – History to add to object.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

read_skyh5(filename, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read a skyh5 file (our flavor of hdf5) into this object.

Parameters
  • filename (str) – Path and name of the skyh5 file to read.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

classmethod from_skyh5(filename, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Create a new SkyModel from skyh5 file (our flavor of hdf5).

Parameters
  • filename (str) – Path and name of the skyh5 file to read.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

read_healpix_hdf5(hdf5_filename, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read hdf5 healpix files into this object.

Deprecated. Support for this file format will be removed in version 0.3.0. Use read_skyh5 to read our newer skyh5 file type.

Parameters
  • hdf5_filename (str) – Path and name of the hdf5 file to read.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

Notes

Currently, this function only converts a HEALPix map with a frequency axis.

classmethod from_healpix_hdf5(hdf5_filename, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Create a new SkyModel from a hdf5 healpix file.

Deprecated. Support for this file format will be removed in version 0.3.0. Use from_skyh5 to create a new SkyModel from our newer skyh5 file type.

Parameters
  • hdf5_filename (str) – Path and name of the hdf5 file to read.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

Notes

Currently, this function only converts a HEALPix map with a frequency axis.

read_votable_catalog(votable_file, table_name, id_column, ra_column, dec_column, flux_columns, reference_frequency=None, freq_array=None, spectral_index_column=None, flux_error_columns=None, source_select_kwds=None, history='', run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read a votable catalog file into this object.

This reader uses the units in the file, the units should be specified following the VOTable conventions.

Parameters
  • votable_file (str) – Path to votable catalog file.

  • table_name (str) – Part of expected table name. Should match only one table name in votable_file.

  • id_column (str) – Part of expected ID column. Should match only one column in the table.

  • ra_column (str) – Part of expected RA column. Should match only one column in the table.

  • dec_column (str) – Part of expected Dec column. Should match only one column in the table.

  • flux_columns (str or list of str) – Part of expected Flux column(s). Each one should match only one column in the table.

  • reference_frequency (astropy.Quantity) – Reference frequency for flux values, assumed to be the same value for all rows.

  • freq_array (astropy.Quantity) – Frequencies corresponding to flux_columns (should be same length). Required for multiple flux columns.

  • spectral_index_column (str) – Part of expected spectral index column. Should match only one column in the table.

  • flux_error_columns (str or list of str) – Part of expected Flux error column(s). Each one should match only one column in the table.

  • source_select_kwds (dict, optional) – This parameter is Deprecated, please use the select and/or the cut_nonrising() methods as appropriate instead.

    Dictionary of keywords for source selection Valid options:

    • latitude_deg: Latitude of telescope in degrees. Used for declination

      coarse horizon cut.

    • horizon_buffer: Angle (float, in radians) of buffer for coarse horizon cut. Default is about 10 minutes of sky rotation. (See caveats in source_cuts() docstring)

    • min_flux: Minimum stokes I flux to select [Jy]

    • max_flux: Maximum stokes I flux to select [Jy]

  • history (str) – History to add to object.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

classmethod from_votable_catalog(votable_file, *args, **kwargs)[source]

Create a SkyModel from a votable catalog.

Parameters

kwargs – All parameters are sent through to read_votable_catalog().

Returns

sky_model (SkyModel) – The object instantiated using the votable catalog.

read_gleam_catalog(gleam_file, spectral_type='subband', source_select_kwds=None, with_error=False, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read the GLEAM votable catalog file into this object.

Tested on: GLEAM EGC catalog, version 2

Parameters
  • gleam_file (str) – Path to GLEAM votable catalog file.

  • spectral_type (str) – One of ‘flat’, ‘subband’ or ‘spectral_index’. If set to ‘flat’, the wide band integrated flux will be used, if set to ‘spectral_index’ the fitted flux at 200 MHz will be used for the flux column.

  • source_select_kwds (dict, optional) – This parameter is Deprecated, please use the select and/or the cut_nonrising() methods as appropriate instead.

    Dictionary of keywords for source selection Valid options:

    • latitude_deg: Latitude of telescope in degrees. Used for declination coarse

      horizon cut.

    • horizon_buffer: Angle (float, in radians) of buffer for coarse horizon cut. Default is about 10 minutes of sky rotation. (See caveats in array_to_skymodel() docstring)

    • min_flux: Minimum stokes I flux to select [Jy]

    • max_flux: Maximum stokes I flux to select [Jy]

  • with_error (bool) – Option to include the errors on the stokes array on the object in the stokes_error parameter. Note that the values assigned to this parameter are the flux fitting errors. The GLEAM paper (Hurley-Walker et al., 2019) specifies that flux scale errors should be added in quadrature to these fitting errors, but that the size of the flux scale errors depends on whether the comparison is between GLEAM sub-bands or with another catalog. Between GLEAM sub-bands, the flux scale error is 2-3% of the component flux (depending on declination), while flux scale errors between GLEAM and other catalogs is 8-80% of the component flux (depending on declination).

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

classmethod from_gleam_catalog(gleam_file, **kwargs)[source]

Create a SkyModel from a GLEAM catalog.

Parameters

kwargs – All parameters are sent through to read_gleam_catalog().

Returns

sky_model (SkyModel) – The object instantiated using the GLEAM catalog.

read_text_catalog(catalog_csv, source_select_kwds=None, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read a text file of sources into this object.

Parameters
  • catalog_csv (str) – Path to tab separated value file with the following required columns: * Source_ID: source name as a string of maximum 10 characters * ra_j2000: right ascension at J2000 epoch, in decimal degrees * dec_j2000: declination at J2000 epoch, in decimal degrees * Flux [Jy]: Stokes I flux density in Janskys

    If flux is specified at multiple frequencies (must be the same set for all components), the frequencies must be included in each column name, e.g. Flux at 150 MHz [Jy]. Recognized units are (‘Hz’, ‘kHz’, ‘MHz’ or ‘GHz’):

    If flux is only specified at one reference frequency (can be different per component), a frequency column should be added (note: assumed to be in Hz): * Frequency: reference frequency [Hz]

    Optionally a spectral index can be specified per component with: * Spectral_Index: spectral index

  • source_select_kwds (dict, optional) – This parameter is Deprecated, please use the select and/or the cut_nonrising() methods as appropriate.

    Dictionary of keywords for source selection. Valid options:

    • latitude_deg: Latitude of telescope in degrees. Used for declination coarse

    • horizon cut.

    • horizon_buffer: Angle (float, in radians) of buffer for coarse horizon cut. Default is about 10 minutes of sky rotation. (See caveats in array_to_skymodel() docstring)

    • min_flux: Minimum stokes I flux to select [Jy]

    • max_flux: Maximum stokes I flux to select [Jy]

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

classmethod from_text_catalog(catalog_csv, **kwargs)[source]

Create a SkyModel from a text catalog.

Parameters

kwargs – All parameters are sent through to read_text_catalog().

Returns

sky_model (SkyModel) – The object instantiated using the text catalog.

read_fhd_catalog(filename_sav, expand_extended=True, source_select_kwds=None, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read in an FHD style catalog file.

FHD catalog files are IDL save files.

Parameters
  • filename_sav (str) – Path to IDL .sav file.

  • expand_extended (bool) – If True, return extended source components. Default: True

  • source_select_kwds (dict, optional) – This parameter is Deprecated, please use the select and/or the cut_nonrising() methods as appropriate.

    Dictionary of keywords for source selection. Valid options:

    • latitude_deg: Latitude of telescope in degrees. Used for declination coarse

    • horizon cut.

    • horizon_buffer: Angle (float, in radians) of buffer for coarse horizon cut. Default is about 10 minutes of sky rotation. (See caveats in array_to_skymodel() docstring)

    • min_flux: Minimum stokes I flux to select [Jy]

    • max_flux: Maximum stokes I flux to select [Jy]

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

classmethod from_fhd_catalog(filename_sav, **kwargs)[source]

Create a SkyModel from an FHD catalog.

Parameters

kwargs – All parameters are sent through to read_fhd_catalog().

Returns

sky_model (SkyModel) – The object instantiated using the FHD catalog.

read_idl_catalog(filename_sav, expand_extended=True, source_select_kwds=None, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Read in an FHD style catalog file.

Deprecated. Use read_fhd_catalog instead.

Parameters
  • filename_sav (str) – Path to IDL .sav file.

  • expand_extended (bool) – If True, return extended source components. Default: True

  • source_select_kwds (dict, optional) – This parameter is Deprecated, please use the select and/or the cut_nonrising() methods as appropriate.

    Dictionary of keywords for source selection. Valid options:

    • latitude_deg: Latitude of telescope in degrees. Used for declination coarse

    • horizon cut.

    • horizon_buffer: Angle (float, in radians) of buffer for coarse horizon cut. Default is about 10 minutes of sky rotation. (See caveats in array_to_skymodel() docstring)

    • min_flux: Minimum stokes I flux to select [Jy]

    • max_flux: Maximum stokes I flux to select [Jy]

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

write_skyh5(filename, clobber=False, data_compression=None, run_check=True, check_extra=True, run_check_acceptability=True)[source]

Write this object to a skyh5 file (our flavor of hdf5).

Parameters
  • filename (str) – Path and name of the file to write to.

  • clobber (bool) – Indicate whether an existing file should be overwritten (clobbered).

  • data_compression (str) – HDF5 filter to apply when writing the stokes data. Default is None (no filter/compression). One reasonable option to reduce file size is “gzip”.

  • run_check (bool) – Option to check for the existence and proper shapes of parameters after downselecting data on this object (the default is True, meaning the check will be run).

  • check_extra (bool) – Option to check optional parameters as well as required ones (the default is True, meaning the optional parameters will be checked).

  • run_check_acceptability (bool) – Option to check acceptable range of the values of parameters after downselecting data on this object (the default is True, meaning the acceptable range check will be done).

write_healpix_hdf5(filename)[source]

Write a set of HEALPix maps to an HDF5 file.

Deprecated. Support for this file format will be removed in version 0.3.0. Use write_skyh5 to read our newer skyh5 file type.

Parameters

filename (str) – Name of file to write to.

write_text_catalog(filename)[source]

Write out this object to a text file.

Readable with read_text_catalog().

Parameters

filename (str) – Path to output file (string)