sourcefinder.accessors.fitsimage ================================ .. py:module:: sourcefinder.accessors.fitsimage Attributes ---------- .. autoapisummary:: sourcefinder.accessors.fitsimage.logger Classes ------- .. autoapisummary:: sourcefinder.accessors.fitsimage.FitsImage Module Contents --------------- .. py:class:: FitsImage(url, plane=None, beam=None, hdu_index=0) Bases: :py:obj:`sourcefinder.accessors.dataaccessor.DataAccessor` Use PyFITS to pull image data out of a FITS file. Provide standard attributes, as per :class:`DataAccessor`. In addition, we provide a ``telescope`` attribute if the FITS file has a ``TELESCOP`` header. :Parameters: **url** : Path or str The path or URL to the FITS file. **plane** : int, default: None If the data is a datacube, specifies which plane to use. **beam** : tuple, default: None Beam parameters in degrees, in the form (bmaj, bmin, bpa). If not supplied, the method will attempt to read these from the header. **hdu_index** : int, default: 0 The index of the HDU to use from the HDU list. .. !! processed by numpydoc !! .. py:method:: _get_header(hdu_index) Retrieve the header from the specified HDU in the FITS file. :Parameters: **hdu_index** : int The index of the Header Data Unit (HDU) to extract the header from. :Returns: astropy.io.fits.Header A copy of the header from the specified HDU. .. !! processed by numpydoc !! .. py:method:: calculate_phase_centre() Calculate the phase center of the FITS image. The phase center is determined by finding the central pixel and converting that position to celestial coordinates. :Returns: tuple[float] A tuple containing the right ascension and declination of the phase center in degrees. .. !! processed by numpydoc !! .. py:method:: parse_beam() Read and return the beam properties bmaj, bmin and bpa values from the FITS header. :Returns: **bmaj** : float the major axis of the beam in degrees. **bmin** : float the minor axis of the beam in degrees. **bpa** : float the position angle of the beam in degrees. .. rubric:: Notes AIPS FITS file: stored in the history section .. !! processed by numpydoc !! .. py:method:: parse_coordinates() Parse header to return a WCS (World Coordinate System) object. :Returns: WCS A WCS object containing the coordinate system information extracted from the FITS file header. :Raises: TypeError If the coordinate system is not specified in the FITS header. .. rubric:: Notes If units are not specified in the header, degrees are assumed by default. .. !! processed by numpydoc !! .. py:method:: parse_frequency() Set some 'shortcut' variables for access to the frequency parameters in the FITS file header. :Returns: **freq_eff** : float The effective frequency extracted from the FITS header. **freq_bw** : float The bandwidth extracted from the FITS header. .. !! processed by numpydoc !! .. py:method:: parse_start_time() Parse and return the start time of the observation, that yielded this FITS image, from its header. :Returns: datetime.datetime The start time of the observation as an instance of `datetime.datetime`. :Raises: KeyError If the timestamp in the FITS file is unreadable. Warning Logged if a non-standard date format is encountered in the FITS file. .. !! processed by numpydoc !! .. py:method:: parse_times() Attempt to do something sane with timestamps. :Returns: **taustart_ts** : datetime.datetime Timezone-naive (implicit UTC) datetime representing the start of the observation. **tau_time** : float Integration time in seconds. .. !! processed by numpydoc !! .. py:method:: read_data(hdu_index, plane) Read data from our FITS file. :Parameters: **hdu_index** : int The index of the Header Data Unit (HDU) to extract the data from. **plane** : int, default: None If the data is a datacube, specifies which plane to use. :Returns: numpy.ndarray The processed 2D data array, transposed for intuitive display. .. rubric:: Notes PyFITS reads the data into an array indexed as [y][x]. We take the transpose to make this more intuitively reasonable and consistent with (eg) ds9 display of the FitsFile. Transpose back before viewing the array with RO.DS9, saving to a FITS file, etc. .. !! processed by numpydoc !! .. py:attribute:: data .. py:attribute:: header .. py:attribute:: pixelsize .. py:attribute:: url .. py:attribute:: wcs .. py:data:: logger