Data Analysis Plugins
The Imviz data analysis plugins are meant to aid quick-look analysis of 2D image data. All plugins are accessed via the plugin icon in the upper right corner of the Imviz application.
Link Control
This plugin is used to re-link images by pixels or WCS using
link_image_data()
.
All images are automatically linked by pixels on load but you can use
it to re-link by pixels or WCS as needed. Once you have set your
options, click LINK to perform the linking.
For WCS linking, the “fast approximation” option uses an affine transform to represent the offset between images, if possible. It is much more performant at the cost of accuracy but should be accurate to within a pixel for most cases. If approximation fails, WCS linking still automatically falls back to full transformation.
For more details on linking, see Linking of datasets in glue.
Simple Aperture Photometry
This plugin performs simple aperture photometry on one object within an interactively selected region. A typical workflow is as follows:
Load image(s) in Imviz (see Import Data).
Draw a region over the object of interest (see Defining Spatial Regions).
Select the desired image using Data drop-down menu.
Select the desired region using Subset drop-down menu.
If you want to subtract background before performing photometry, enter the background value in the Background value field. This value must be in the same unit as display data, if applicable. If your image is already background subtracted, leave it at 0.
For some JWST and HST images, pixel area in arcsec squared is automatically populated in the Pixel area field from image metadata. If it does not auto-populate for you, you can manually enter a value but it must be in the unit of arcsec squared. This field is only used if per steradian is detected in display data unit. Otherwise, it is only informational. If this field is not applicable for you, leave it at 0. This field resets every time Data selection changes if auto-population not possible.
If you also want photometry result in the unit of counts, you can enter a conversion factor in the Counts conversion factor field. The value must be in the unit of display data unit per counts. This is used to convert linear flux unit (e.g., MJy/sr) to counts. If this field is not applicable for you, leave it at 0. This field resets every time Data selection changes.
If you also want photometry result in magnitude unit, you can enter a flux scaling factor in the Flux scaling field. The value must be in the same unit as display data unit. A magnitude is then calculated using
-2.5 * log(flux / flux_scaling)
. This calculation only makes sense if your display data unit is already in linear flux unit. Setting this to 1 is equivalent to not applying any scaling. If this field is not applicable for you, leave it at 0. This field resets every time Data selection changes.Once all inputs are populated correctly, click on the CALCULATE button to perform simple aperture photometry.
Note
Masking and weights by uncertainty are currently not supported. However, if NaN exists in data, it will be treated as 0.
When calculation is complete, the results are displayed under the
CALCULATE button. You can also retrieve the results as
QTable
as follows, assuming imviz
is the instance
of your Imviz application:
results = imviz.get_aperture_photometry_results()
When multiple calculations are done in the same session (e.g., calculating
aperture photometry for the same region across different images or for
different regions on the same image), imviz.get_aperture_photometry_results()
will return all the calculations in the same table, if possible.
However, if the newest result is incompatible with the existing ones (e.g., two
images have very different units), only the newest is kept in the table.
When you are unsure, save the results after each calculation as different
variables in your Python session.
The output table contains the results you see in the plugin and then some. The columns are as follow:
id
: ID number assigned to the row, starting from 1.xcenter
,ycenter
: Pixel center of the region used. No re-centering w.r.t. flux distribution is done.sky_center
:SkyCoord
associated withxcenter
andycenter
. If WCS is not available, this field isNone
.background
: The value from Background value, with unit attached.npix
: The number of pixels covered by the region. Partial coverage is reported as fraction.aperture_sum
: Sum of flux in the aperture. If per steradian is in input data unit, total pixel area covered in steradian is already multiplied here, if applicable, so there will be no per steradian in its unit. Otherwise, it has the same unit as input data. To calculate this,regions.PixelRegion.to_mask()
is used withmode='exact'
except for rectangular region, where it is used withmode='subpixels'
andsubpixels=32
. Values from aperture mask are extracted usingregions.RegionMask.get_values()
.pixarea_tot
: If per steradian is in input data unit and pixel area is provided, this contains the total pixel area covered by the aperture in steradian. Otherwise, it isNone
.aperture_sum_counts
: This is the aperture sum converted to counts, if Counts conversion factor was set. Otherwise, it isNone
. This calculation is done without taking account ofpixarea_tot
, even when it is available.aperture_sum_counts_err
: This is the Poisson uncertainty (square root) foraperture_sum_counts
. Other uncertainty factors like readnoise are not included. In the plugin, it is displayed within parenthesis next to the value foraperture_sum_counts
, if applicable.counts_fac
: The value from Counts conversion factor, with unit attached, if applicable. Otherwise, it isNone
.aperture_sum_mag
: This is the aperture sum converted to magnitude, if Flux scaling was set. Otherwise, it isNone
. This calculation is done without taking account ofpixarea_tot
, even when it is available.flux_scaling
: The value from Flux scaling, with unit attached, if applicable. Otherwise, it isNone
.mean
,stddev
,median
,min
,max
: Basic statistics from all the pixels in the region. These are done usingregions.PixelRegion.to_mask()
withmode='center'
, unlikeaperture_sum
. They are not related to the aperture photometry, but are only provided as supplemental information.data_label
: Data label of the image used.subset_label
: Subset label of the region used.timestamp
: Timestamp of when the photometry was performed asTime
.
Once you have the results in a table, you can further manipulated them as documented in Data Tables (astropy.table).