-
Notifications
You must be signed in to change notification settings - Fork 1
Functions
The top level functions are described here (in approximate order of importance). Each can be invoked as polspectra.<function>.
from_FITS(filename)
Read a polarization spectrum table from a FITS file into a polarizationspectra object.
from_arrays(long_array,lat_array, freq_array, StokesI,StokesI_error,
StokesQ,StokesQ_error,StokesU,StokesU_error,source_number_array,
beam_major,beam_minor,beam_pa,coordinate_system='icrs',
StokesV=None,StokesV_error=None,quality=None,
quality_meanings=None,ionosphere=None,cat_id=None,dataref=None,
telescope=None,epoch=None,integration_time=None,interval=None,
leakage=None,channel_width=None,flux_type=None,aperture=None)
Create a polarization spectrum table from a series of provided columns (with corresponding variable names). Longitude and latitude arrays can be any coordinate system, so long as the coordinate_system variable is set appropriately (inside the table, the coordinates will be converted to both ICRS and Galactic). See the usage page for more details about the concepts used in defining the table format and how to create PolSpectra tables.
create_from_arrays(self,long_array,lat_array, freq_array, StokesI,StokesI_error,
StokesQ,StokesQ_error,StokesU,StokesU_error,source_number_array,
beam_major,beam_minor,beam_pa,coordinate_system='icrs',
StokesV=None,StokesV_error=None,quality=None,
quality_meanings=None,ionosphere=None,cat_id=None,dataref=None,
telescope=None,epoch=None,integration_time=None,interval=None,
leakage=None,channel_width=None,flux_type=None,aperture=None)
Create a polarization spectrum table from a series of provided columns (with corresponding variable names). Longitude and latitude arrays can be any coordinate system, so long as the coordinate_system variable is set appropriately (inside the table, the coordinates will be converted to both ICRS and Galactic). See the usage page for more details about the concepts used in defining the table format and how to create PolSpectra tables.
add_column(self,values,name,description,units='')
Add a new column (with a single value per row) to the table. If a single (scalar) value is supplied, it will be applied to all rows in the table.
add_channel_column(self,values,name,description,units)
Add a new column, where each row contains an array of entries (one per channel). Must have the same number of channels as the other channel columns (frequency, Stokes parameters, etc.) and the same number of rows as the table.
write_FITS(self,filename,overwrite=False)
Write table to FITS file, taking care to ensure that channel columns are preserved as expected.
read_FITS(self,filename)
Read in a polarization spectrum table from a FITS file.
merge_tables(self,table2,merge_type='exact',source_numbers='keep')
Merges another polarization spectrum table into this one. The merge_type parameter determines how differences in columns are handled: 'exact' requires both tables to have the same columns, 'inner' will remove columns unique to only one of the tables, 'outer' will keep all columns from both and will fill missing values with blanks. The source_numbers parameter determines how the source identifier numbers are handled: 'keep' will not change the source numbers from either input table, 'concat' will shift the source numbers in the second table to not overlap with the values in the first table.
renumber_sources(self)
Re-writes the source_number column to be consecutive from 0 to N-1. Useful when you have extracted a subset of sources from a larger catalog and want to convert it back to a consecutive range.
copy(self)
Returns a copy of the polarization spectrum table.
verify_table(self)
Checks the table for some of the most common problems: 1. inconsistent number of channels within a single row; 2. obvious unit errors (frequencies not in Hz, beam sizes not in degrees). Prints warnings to terminal if it finds any data that looks suspicious.
crossmatch_sources(self,radius,consecutive=True)
Groups together sources (by giving them the same source_number) based on position cross-matching (using the user supplied cross-match radius in degrees). If the consecutive parameter is True, then the source numbers will be renumbered at the end to be a consecutive range.