Import & Export RoIs#

Import RoIs#

Using madcubapy.regions.import_roi() the user can import RoIS from datafiles exported by other astronomical programs. The supported formats are:

The RoIs are imported as matplotlib.patches that can be added to an Axes or WCSAxes object. The functions accept kwargs that are passed for the creation of the Patch.

The user needs to provide a CCDData or MadcubaMap object through the fitsmap parameter if the RoI has been stored using World coordinates instead of Image coordinates (pixels).

>>> ds9_rectangle = import_roi(input_file="rectangle-world.ds9",
                               fitsmap=example_map,
                               color='blue', alpha=0.7)

For a complete example on how to import and plot a RoI using madcubapy check the Import RoIs example.

Export RoIs#

The madcubapy.regions.export_roi() allows users to export Patch objects as datafiles that can be imported in other astronomy programs. Supported formats for output of RoIs are:

  • PYROI (can be imported into MADCUBA and madcubapy).

  • CRTF (can be improted into MADCUBA, CARTA, DS9, and madcubapy)

The user must select the desired file format and coordinate frame through the format and coord_frame parameters, respectively.

>>> export_roi(circle_patch,
               output="circle-world.crtf",
               format="crtf",
               coord_frame="world",
               fitsmap=example_map)

Note

For world coordinates, only ICRS is currently supported. More will be added in the future through the coord_system parameter.