<p>This was already answered <a href="https://astronomy.stackexchange.com/questions/51453/conversion-to-jy-of-hubble-wfc3-units-electrons-s-and-of-spitzer-irac-mjy-sr">by a post</a> I initially ignored as I thought it didn't pertain to my problem. It literally answers everything, if you have found yourself in a similar boat to me, read the entire (at least HST part of the) question <em>and then</em> the entire <strong>answer</strong> to the question, in which the post is clarified in the areas I was confused on.</p>
<p>Additionally, I was trying to figure out &quot;Absolute Magnitude&quot; for a galaxy... while this is technically possible it's apparently very silly, instead you should determine surface brightness. <a href="https://myslu.stlawu.edu/%7Eaodo/astronomy/ALFALFA/Astronomy%20Basics/GalaxyPhotometry.pdf" rel="nofollow noreferrer">Here's a really good document on how to do that</a>.</p>
<p>Also, in case you need it, I've discovered that it's very simple to call header values from FITS files, <a href="https://docs.astropy.org/en/stable/io/fits/usage/headers.html" rel="nofollow noreferrer">check this astropy link</a>.</p>

CC BY-SA 4.0
2024-01-13T14:28:17.983Z
I'm glad you found a solution, but why do you say that the absolute magnitude of a galaxy is silly? It's one of the main characteristics of a galaxy, although usually not bolometric but in some band, e.g. the UV band. You use it to be able to compare how a galaxy population evolves statistically through cosmic time, through the so-called luminosity function which gives the number density of galaxies as a function of their absolute magnitude
pela
CC BY-SA 4.0
2024-01-13T21:18:57.303Z
Ah, because in my research on how to calculate absolute magnitude of a galaxy I found that it was apparently better to use surface brightness instead as the magnitude system was made for stars. What I found online said that absolute magnitude over an area would require fairly precise measurements of the object's distance and size so instead it proves more useful to determine the surface brightness as it only requires pixel size and luminosity. (Also note that I've jumped into the deep end here so a lot of these equations are new to me, didn't know what a gamma function was until yesterday).
Ataaamic
CC BY-SA 4.0
2024-01-15T12:25:10.633Z
I think perhaps you may be confusing some terms, or perhaps I'm just confused. It's true that, to calculate absolut luminosities/magnitudes, you need to know the distance. But that's the case whether you are dealing with surface brightness (i.e. magnitude per area), or total luminosity (i.e. integrated magnitude). "Absolute magnitude" and "surface brightness" are simply two different (but related) quantities that tell you two different (but related) things. In your case, you might be interested in SB, I was more objecting to your characterization of "absolute magnitude" as being silly :)
pela
CC BY-SA 4.0
2024-01-12T23:08:18.927Z
2024-01-13T21:20:07.540Z
2024-01-13T21:20:07.540Z
Ataaamic
<p>I'm attempting my first serious research project but due to... various circumstances, I am going to mostly be solving problems like this on my own with minimal outside help.</p>
<p>As for the actual problem, I'm planning to use astropy (and the other important python modules) to determine the measured magnitude (or luminosity or something similar) of a galaxy between JWST and the HST. The galaxy is called 2dFGRS TGS360Z233 if any are interested. It has a really intruiging structure and I'd like to stick to this galaxy if possible while also still being open to changing to another target (maybe one that has enough data from SSDS9 to compare to HST's optical data).</p>
<p>All the same right now I've thus far figured out how to center and zoom the image in on our galaxy using the Cutout2D module of astropy, but I have no idea how to maintain ALL header data (notably the important 'PHOTOMETRY KEYWORDS' part of it) and I have no idea how to transform that information in the header into... flux, magnitude or whatever.</p>
<p>Here's what one of the FITS files comes with in the science header:</p>
<p>XTENSION= 'IMAGE   '           / Image extension<br />
BITPIX  =                  -32 / array data type<br />
NAXIS   =                    2 / number of array dimensions<br />
NAXIS1  =                 4130<br />
NAXIS2  =                 4389<br />
PCOUNT  =                    0 / number of parameters<br />
GCOUNT  =                    1 / number of groups</p>
<p>...</p>
<p>BUNIT   = 'ELECTRONS/S'        / Units of science product</p>
<p>...</p>
<pre><code>          / PHOTOMETRY KEYWORDS
                                                                            
</code></pre>
<p>PHOTMODE= 'WFC3 UVIS2 F225W MJD#59172.1106' / Obser<br />
PHOTFLAM=      4.632454625E-18 / Inverse sensitivity, ergs/cm2/A/e-<br />
PHTFLAM1=   4.715093700000E-18 / Ch1 Inv Sens, use PHOTFLAM for UV filters<br />
PHTFLAM2=        3.8279528E-18 / Ch2 Inv Sens, use PHOTFLAM if FLUXCORR=COMPLETE<br />
PHTRATIO=   8.118508440246E-01 / PHTFLAM2/PHTFLAM1 ratio<br />
PHOTFNU =      7.975719775E-07 / Inverse sensitivity, Jy*sec/e-<br />
PHOTZPT =       -2.1100000E+01 / ST magnitude zero point<br />
PHOTPLAM=           2365.22155 / Pivot wavelength (Angstroms)<br />
PHOTBW  =            175.29026 / RMS bandwidth of filter plus detector</p>
<p>I'm aware that the photometry values are important and can be used to determine magnitude, however I cannot find a single thing talking about how one uses this information to begin determining the absolute magnitude of a galaxy, much less a star.</p>
<p>The current plan is to take an average (or gaussian or similar thing) of all the pixels in the cut down version of the FITS file that's focused on our galaxy and somehow turn that into magnitude using the data above. The problem is that I'm very new to... all of this, and can't find any concrete information on how one would use any of the above to get Absolute Magnitude. I know there's multiple methods to determine absolute magnitude but honestly I do not care which one I end up using because I <em>did</em> find a reasonable amount of documentation on conversion.</p>
<p>So my question is, how does one turn the data given in the photometry keywords to... I think convert pixel values into magnitude to then use a bunch of math on. I have no idea what the value of each pixel ACTUALLY represents and I am trying to avoid some methods I've seen for regular photos as I don't think that would match the data I would get using actual magnitude. So, if anyone knows either:</p>
<p>How to turn the data given in the PHOTOMETRY KEYWORDS (notably the PHOTZPT and the PHOTFNU values) into magnitude given pixel brightness and whatnot</p>
<p>OR</p>
<p>How one can calculate this magnitude without even looking at these values and instead taking advantage of some feature I don't know about using FITS files to practically do it automatically (you know, so I can automate this process for the many images I want to measure)</p>
<p>... I'd be very grateful for your help.</p>
<p>(Of potentially important note, I <em>do</em> know how to determine distance of an object using astropy.cosmology and I am aware that I'll need this when calculating but I can't get started on doing any of that until I know how to convert ONLY the pixel values of our galaxy into the data needed to begin determining abs mag.)</p>

<data-analysis><hubble-telescope><magnitude><astropy><absolute-magnitude>
How to Determine Absolute Magnitude of a Galaxy using HST FITS Image
Ataaamic
# How to Determine Absolute Magnitude of a Galaxy using HST FITS Image

(Asked by: username_0 on 2024-01-12)

I'm attempting my first serious research project but due to... various circumstances, I am going to mostly be solving problems like this on my own with minimal outside help.
As for the actual problem, I'm planning to use astropy (and the other important python modules) to determine the measured magnitude (or luminosity or something similar) of a galaxy between JWST and the HST. The galaxy is called 2dFGRS TGS360Z233 if any are interested. It has a really intruiging structure and I'd like to stick to this galaxy if possible while also still being open to changing to another target (maybe one that has enough data from SSDS9 to compare to HST's optical data).
All the same right now I've thus far figured out how to center and zoom the image in on our galaxy using the Cutout2D module of astropy, but I have no idea how to maintain ALL header data (notably the important 'PHOTOMETRY KEYWORDS' part of it) and I have no idea how to transform that information in the header into... flux, magnitude or whatever.
Here's what one of the FITS files comes with in the science header:
XTENSION= 'IMAGE   '           / Image extension
BITPIX  =                  -32 / array data type
NAXIS   =                    2 / number of array dimensions
NAXIS1  =                 4130
NAXIS2  =                 4389
PCOUNT  =                    0 / number of parameters
GCOUNT  =                    1 / number of groups
...
BUNIT   = 'ELECTRONS/S'        / Units of science product
...
          / PHOTOMETRY KEYWORDS
                                                                            

PHOTMODE= 'WFC3 UVIS2 F225W MJD#59172.1106' / Obser
PHOTFLAM=      4.632454625E-18 / Inverse sensitivity, ergs/cm2/A/e-
PHTFLAM1=   4.715093700000E-18 / Ch1 Inv Sens, use PHOTFLAM for UV filters
PHTFLAM2=        3.8279528E-18 / Ch2 Inv Sens, use PHOTFLAM if FLUXCORR=COMPLETE
PHTRATIO=   8.118508440246E-01 / PHTFLAM2/PHTFLAM1 ratio
PHOTFNU =      7.975719775E-07 / Inverse sensitivity, Jy*sec/e-
PHOTZPT =       -2.1100000E+01 / ST magnitude zero point
PHOTPLAM=           2365.22155 / Pivot wavelength (Angstroms)
PHOTBW  =            175.29026 / RMS bandwidth of filter plus detector
I'm aware that the photometry values are important and can be used to determine magnitude, however I cannot find a single thing talking about how one uses this information to begin determining the absolute magnitude of a galaxy, much less a star.
The current plan is to take an average (or gaussian or similar thing) of all the pixels in the cut down version of the FITS file that's focused on our galaxy and somehow turn that into magnitude using the data above. The problem is that I'm very new to... all of this, and can't find any concrete information on how one would use any of the above to get Absolute Magnitude. I know there's multiple methods to determine absolute magnitude but honestly I do not care which one I end up using because I did find a reasonable amount of documentation on conversion.
So my question is, how does one turn the data given in the photometry keywords to... I think convert pixel values into magnitude to then use a bunch of math on. I have no idea what the value of each pixel ACTUALLY represents and I am trying to avoid some methods I've seen for regular photos as I don't think that would match the data I would get using actual magnitude. So, if anyone knows either:
How to turn the data given in the PHOTOMETRY KEYWORDS (notably the PHOTZPT and the PHOTFNU values) into magnitude given pixel brightness and whatnot
OR
How one can calculate this magnitude without even looking at these values and instead taking advantage of some feature I don't know about using FITS files to practically do it automatically (you know, so I can automate this process for the many images I want to measure)
... I'd be very grateful for your help.
(Of potentially important note, I do know how to determine distance of an object using astropy.cosmology and I am aware that I'll need this when calculating but I can't get started on doing any of that until I know how to convert ONLY the pixel values of our galaxy into the data needed to begin determining abs mag.)

**Tags:** data-analysis, hubble-telescope, magnitude, astropy, absolute-magnitude


---

## 1 answers

### Answer by username_0 on 2024-01-12. Score: 5 | Accepted answer

This was already answered [by a post](https://astronomy.stackexchange.com/questions/51453/conversion-to-jy-of-hubble-wfc3-units-electrons-s-and-of-spitzer-irac-mjy-sr) I initially ignored as I thought it didn't pertain to my problem. It literally answers everything, if you have found yourself in a similar boat to me, read the entire (at least HST part of the) question *and then* the entire **answer** to the question, in which the post is clarified in the areas I was confused on.

Additionally, I was trying to figure out "Absolute Magnitude" for a galaxy... while this is technically possible it's apparently very silly, instead you should determine surface brightness. [Here's a really good document on how to do that](https://myslu.stlawu.edu/%7Eaodo/astronomy/ALFALFA/Astronomy%20Basics/GalaxyPhotometry.pdf).

Also, in case you need it, I've discovered that it's very simple to call header values from FITS files, [check this astropy link](https://docs.astropy.org/en/stable/io/fits/usage/headers.html).

> **Comments:**
> **username_1**: I'm glad you found a solution, but why do you say that the absolute magnitude of a galaxy is silly? It's one of the main characteristics of a galaxy, although usually not bolometric but in some band, e.g. the UV band. You use it to be able to compare how a galaxy population evolves statistically through cosmic time, through the so-called luminosity function which gives the number density of galaxies as a function of their absolute magnitude  
> **username_0**: Ah, because in my research on how to calculate absolute magnitude of a galaxy I found that it was apparently better to use surface brightness instead as the magnitude system was made for stars. What I found online said that absolute magnitude over an area would require fairly precise measurements of the object's distance and size so instead it proves more useful to determine the surface brightness as it only requires pixel size and luminosity. (Also note that I've jumped into the deep end here so a lot of these equations are new to me, didn't know what a gamma function was until yesterday).  
> **username_1**: I think perhaps you may be confusing some terms, or perhaps I'm just confused. It's true that, to calculate absolut luminosities/magnitudes, you need to know the distance. But that's the case whether you are dealing with surface brightness (i.e. magnitude per area), or total luminosity (i.e. integrated magnitude). "Absolute magnitude" and "surface brightness" are simply two different (but related) quantities that tell you two different (but related) things. In your case, you might be interested in SB, I was more objecting to your characterization of "absolute magnitude" as being silly :)  

---

