Pulsar tool¶
arts_tools.pulsars.find_pulsars¶
- arts_tools.pulsars.find_pulsars.get_half_power_width(freq)¶
Calculate compound beam half-power width, assuming linear scaling with frequency
- Parameters:
freq (Quantity) – Frequency
- Returns:
half-power width (Quantity)
- arts_tools.pulsars.find_pulsars.main()¶
- arts_tools.pulsars.find_pulsars.make_plot(cb_coord, psr_coord, hpbw)¶
Create a plot of the CB pattern with pulsar locations
- Parameters:
cb_coord (list) – List of SkyCoord objects with CB pointings
psr_coord (list) – List of (name, SkyCoord) tuples with pulsar names and positions
hpbw (Quantity) – half-power beam width of the CBs
ALTA downloads¶
arts_tools.archive.download_from_alta¶
- arts_tools.archive.download_from_alta.get_file_paths(release, taskid, cbs, tabs)¶
Construct path to files in ALTA
- Parameters:
release (str) – Data release (SVC or internal)
taskid (str) – Observation taskid
cbs (iterator) – compound beams to download
tabs (iterator) – tied-array beams to download of each compound beam
- Returns:
list of file paths
- arts_tools.archive.download_from_alta.main()¶
arts_tools.archive.download_helpers¶
- class arts_tools.archive.download_helpers.DownloadProgressBar(*_, **__)¶
Bases:
tqdm
A progress bar for downloads using tqdm based on https://stackoverflow.com/questions/15644964/python-progress-bar-and-downloads
- update_to(nbyte=1, blocksize=1, totalsize=None)¶
- arts_tools.archive.download_helpers.download_irods(path, output_folder=None, overwrite=False)¶
Download file from ALTA using iRODS
- Parameters:
path – Path to file on iRODS server
output_folder (str) – Output folder (Default: current directory)
overwrite (bool) – Overwrite output file if it already exists
- arts_tools.archive.download_helpers.download_url(url, output_folder=None, overwrite=False, verbose=False)¶
Download file from given url
- Parameters:
url – URL to download file from
output_folder (str) – Output folder (Default: current directory)
overwrite (bool) – Overwrite output file if it already exists
verbose (bool) – Print download progress
- arts_tools.archive.download_helpers.format_bytes(nbytes)¶
Format a number in bytes with a prefix
- Parameters:
nbytes (int) – number of bytes (>0)
- Returns:
number of MB/GB etc (float), unit (MB/GB etc) (str)
- arts_tools.archive.download_helpers.print_progress(nblock, nbyte_per_block, nbyte_total, step=5)¶
Print download progress of urllib.request.urlretrieve command
- Parameters:
nblock –
nbyte_per_block –
total_bytes –
step (int) – progress is only printed if the percentage is a multiple of step
FITS file handling¶
arts_tools.fits.reader¶
- arts_tools.fits.reader.read_header(fname, hdu=None)¶
Read fits header
- Parameters:
fname (str) – Path to fits file
hdu (int/str) – HDU to read header from (default: all)
- Returns:
header (astropy.io.fits.header.Header) or list of headers if hdu is not specified
- arts_tools.fits.reader.read_parameterset(fname)¶
Read observation parameterset from fits file
- Parameters:
fname (str) – Path to fits file
- Returns:
parameterset (dict)
arts_tools.fits.fix_file_from_before_20200408¶
- arts_tools.fits.fix_file_from_before_20200408.ALIGN = 2880¶
fits file alignment block size in bytes
- arts_tools.fits.fix_file_from_before_20200408.NAXIS1 = 30220¶
NAXIS1 in original data
- arts_tools.fits.fix_file_from_before_20200408.NCHAN = 384¶
Number of frequency channels in original data
- arts_tools.fits.fix_file_from_before_20200408.NSAMP = 500¶
Number of time samples per subint in original data
- arts_tools.fits.fix_file_from_before_20200408.TSUBINT = 1.024¶
Number of seconds per subint in original data
- arts_tools.fits.fix_file_from_before_20200408.fix_data(data, naxis2)¶
Fix the data: Swap time and frequency axis, reverse frequency ordering
- Parameters:
data (bytes) – raw data, without padding
naxis2 (int) – NAXIS2 value
- Returns:
fixed data (bytes)
- arts_tools.fits.fix_file_from_before_20200408.fix_header(header, naxis2, force=False)¶
Fix the header: replace NAXIS2 = 0 by correct value and replaces data column bits by bytes
- Parameters:
header (str) – full header, including padding, as single string
naxis2 (int) – new NAXIS2 value
force (bool) – Overwrite NAXIS2 even if original value was not zero
- Returns:
fixed header (bytes)
- arts_tools.fits.fix_file_from_before_20200408.get_data(fname, hdr_size)¶
Read raw data
- Parameters:
fname (str) – Path to fits file
hdr_size (int) – Header size in bytes, aligned to fits block
- Returns:
raw data (bytes), padding (bytes), derived naxis2 (int)
- arts_tools.fits.fix_file_from_before_20200408.get_header(fname)¶
Read header from fits file, assuming there are 2 HDUs
- Parameters:
fname (str) – Path to fits file
- Returns:
raw header (bytes), header size in bytes (int)
- arts_tools.fits.fix_file_from_before_20200408.main()¶
- arts_tools.fits.fix_file_from_before_20200408.write_file(fname, *args)¶
Write output file
- Parameters:
fname – path to output file
args – byte array to write to file, usually header, data, and padding
IQUV PSRDADA to PSRFITS conversion¶
arts_tools.iquv.psrdada_to_fits¶
General tools¶
- arts_tools.tools.altaz_to_hadec(alt, az, lat=<Latitude 52.91532992 deg>)¶
Convert Alt, Az to HA, Dec
- Parameters:
alt – altitude with unit
az – azimuth with unit
lat – Latitude with unit (default: WSRT)
- Returns:
hour angle, declination
- arts_tools.tools.cb_index_to_pointing(cb, pointing_ra, pointing_dec)¶
Get pointing of given CB based on telescope pointing
- Parameters:
cb (int/list) – CB index
pointing_ra (Quantity) – Pointing right ascension
pointing_dec (Quantity) – Pointing Declination
- Returns:
(RA, Dec) tuple of CB pointing, with unit
- arts_tools.tools.coord_to_offset(ra0, dec0, ra1, dec1)¶
Convert point (ra1, dec1) to projected offset from reference (ra0, dec0)
- Parameters:
ra0 – Reference RA or Az
dec0 – Reference Dec or Alt
ra1 – Target RA or Az
dec1 – Target Dec or Alt
- Returns:
(theta, phi) offset theta is offset in RA or Az phi is offset in Dec or Alt
- arts_tools.tools.hadec_to_altaz(ha, dec, lat=<Latitude 52.91532992 deg>)¶
Convert HA, Dec to Alt, Az
- Parameters:
ha – hour angle with unit
dec – declination with unit
lat – Latitude with unit (default: WSRT)
- Returns:
altitude, azimuth
- arts_tools.tools.hadec_to_par(ha, dec, lat=<Latitude 52.91532992 deg>)¶
Convert HA, Dec to parallactic angle
- Parameters:
ha – hour angle with unit
dec – declination with unit
lat – Latitude with unit (default: WSRT)
- Returns:
parallactic angle
- arts_tools.tools.hadec_to_proj(ha, dec, lat=<Latitude 52.91532992 deg>)¶
Convert HA, Dec to E-W baseline projection angle
- Parameters:
ha – hour angle with unit
dec – declination with unit
lat – Latitude with unit (default: WSRT)
- Returns:
projection angle
- arts_tools.tools.hadec_to_radec(ha, dec, t, lon=<Latitude 52.91532992 deg>)¶
Convert apparent HA, Dec to J2000 RA, Dec
- Parameters:
ha – hour angle with unit
dec – declination with unit
t – UT time (string or astropy.time.Time)
lon – Longitude with unit (default: WSRT)
- Returns:
SkyCoord object of J2000 coordinates
- arts_tools.tools.limit(val, minval=-1, maxval=1)¶
Where val > maxval, replace by maxval
Where val < minval, replace by minval
- Parameters:
val – input value
minval – minimum value
maxval – maximum value
- Returns:
limited value
- arts_tools.tools.offset_to_coord(ra0, dec0, theta, phi)¶
Convert a projected offset (theta, phi) to coordinate with reference (ra0, dec0)
- Parameters:
ra0 – Reference RA or Az
dec0 – Reference Dec or Alt
theta – RA or Az offset
phi – Dec or Alt offset
- Returns:
(Ra, Dec) or (Az, Alt) of offset point
- arts_tools.tools.radec_to_hadec(ra, dec, t, lon=<Longitude 6.60894465 deg>)¶
Convert J2000 RA, Dec to apparent HA, Dec
- Parameters:
ra – right ascension with unit
dec – declination with unit
t – UT time (string or astropy.time.Time)
lon – Longitude with unit (default: WSRT)
- Returns:
HA, Dec with unit