MadcubaMap#

class madcubapy.io.MadcubaMap(data=None, header=None, wcs=None, unit=None, restfreq=None, sigma=None, integrated_range=None, hist=None, ccddata=None, filename=None, _update_hist_on_init=True, _bypass_ccddata_conflict_check=False)[source]#

Bases: MadcubaFits

A container for MADCUBA FITS maps, using the MadcubaFits interface.

This class is basically a wrapper to read MADCUBA exported FITS maps and their history files with astropy.

Parameters:
datandarray

The data array contained in the FITS file.

headerHeader

The header object associated with the FITS file.

wcsWCS

Object with the world coordinate system for the data.

unitUnit

The unit of the data.

restfreqQuantity

Rest frequency of the FITS file.

sigmaQuantity

The noise of the data.

integrated_rangeQuantity

The range selected for integrating the map.

histTable

Table containing the history information of the FITS file, which is stored in a separate _hist.csv file.

ccddataCCDData

An astropy CCDData object loaded with astropy as a failsafe.

filenamestr

Name of the FITS file.

Methods

add_hist(*args)

Load the history table from a csv file.

Attributes Summary

ccddata

CCDData : An astropy CCDData object loaded with astropy as a failsafe.

data

ndarray : The data array contained in the FITS file.

filename

str : Name of the FITS file.

header

Header : The header object associated with the FITS.

hist

Table : Table containing the history information.

integrated_range

Quantity or ndarray : The range selected for integrating the map.

restfreq

Quantity : The rest frequency of the FITS file.

sigma

Quantity : The noise of the data.

unit

Unit : The unit of the data.

wcs

WCS : Object with the world coordinate system for the data.

Methods Summary

add_hist(filename)

Load the history table from a csv file.

convert_unit_to(unit)

Convert the units of the map to other units.

copy()

Create a copy of the MadcubaMap.

fix_units()

Tries to fix problems when the units are incorrectly parsed.

get_input(**kwargs)

Return mouse click coordinates from this map.

read(filepath, **kwargs)

Classmethod to generate a MadcubaMap object from a FITS file.

show(**kwargs)

Show the map in a pop-up window.

update_header_keyword(key, value[, comment])

Update a single header keyword.

update_sigma([statistic])

Measure the noise (sigma) of the map by calculating the standard deviation (std) or root mean square (rms) inside several polygons selected by mouse clicks, and store it in the SIGMA header card.

write(filepath, **kwargs)

Write a MadcubaMap into a FITS file alongside its history file.

Attributes Documentation

ccddata#

CCDData : An astropy CCDData object loaded with astropy as a failsafe.

data#

ndarray : The data array contained in the FITS file.

filename#

str : Name of the FITS file.

header#

Header : The header object associated with the FITS. file.

hist#

Table : Table containing the history information.

integrated_range#

Quantity or ndarray : The range selected for integrating the map.

restfreq#

Quantity : The rest frequency of the FITS file.

sigma#

Quantity : The noise of the data.

unit#

Unit : The unit of the data.

wcs#

WCS : Object with the world coordinate system for the data.

Methods Documentation

add_hist(filename)#

Load the history table from a csv file.

Parameters:
filenamestr or Path

Path of the history csv file.

convert_unit_to(unit)[source]#

Convert the units of the map to other units.

copy()[source]#

Create a copy of the MadcubaMap.

fix_units()[source]#

Tries to fix problems when the units are incorrectly parsed. The user should confirm that the new units are correct.

get_input(**kwargs)[source]#

Return mouse click coordinates from this map.

Other Parameters:
**kwargs

Additional parameters passed to add_wcs_axes().

classmethod read(filepath, **kwargs)[source]#

Classmethod to generate a MadcubaMap object from a FITS file. This method creates an CCDData from the FITS file.

Parameters:
filepathstr

Name of FITS file.

Other Parameters:
**kwargs

Additional keyword parameters passed through to the Astropy fits_ccddata_reader() function.

show(**kwargs)[source]#

Show the map in a pop-up window.

Other Parameters:
**kwargs

Additional parameters passed to add_wcs_axes().

update_header_keyword(key, value, comment=None)[source]#

Update a single header keyword. This method correctly adds the header key to both the MadcubaMap object and the ccddata attribute.

Parameters:
keystr

Header keyword to update.

value

Value to assign to the header keyword.

commentstr, optional

Comment for the header keyword. If None, keep existing comment.

update_sigma(statistic='std', **kwargs)[source]#

Measure the noise (sigma) of the map by calculating the standard deviation (std) or root mean square (rms) inside several polygons selected by mouse clicks, and store it in the SIGMA header card.

  • Left clicks create polygon vertices.

  • Right click closes the current polygon, and a subsequent left click starts a new polygon.

Parameters:
statistic{‘std’, ‘rms’}, optional

Statistic to be used as sigma. Defaults to ‘std’ and can be changed at runtime via GUI buttons.

Other Parameters:
**kwargs

Additional parameters passed to add_wcs_axes().

write(filepath, **kwargs)[source]#

Write a MadcubaMap into a FITS file alongside its history file.

Parameters:
filepathstr

Name of output FITS file.

Other Parameters:
**kwargs

Additional keyword parameters passed through to the Astropy fits_ccddata_writer() function.