Anyone familiar with Montage?

Ask questions, find resources, browse the virtual shelves.
JeanTate
Science Officer
Posts: 113
Joined: Wed Sep 08, 2010 12:35 am

Anyone familiar with Montage?

Postby JeanTate » Mon Feb 04, 2013 9:36 pm

In particular, the mJPEG utility.

I have three SDSS FITS, cutouts created by GALFIT, all the same size, all centered on the same object; mJPEG gets upset: "Red and green FITS images don't match." From the detailed dump, I see that the values for crval1, crval2, crpix1, crpix2, and crota2 are not the same, in the two FITS ('red' and 'green'; I expect the same mismatch for 'blue').

What are these parameters? Which ones need to be the same, for mJPEG to work? How to create a (set of) FITS with values that mJPEG will accept?

Of course, I can simply edit two FITS headers, copying the values of these five parameters from the third (and this will no doubt work, sorta), but I'd *much* prefer to know what I'm doing ...

User avatar
Chris Peterson
Abominable Snowman
Posts: 13277
Joined: Wed Jan 31, 2007 11:13 pm
Location: Guffey, Colorado, USA

Re: Anyone familiar with Montage?

Postby Chris Peterson » Mon Feb 04, 2013 9:47 pm

JeanTate wrote:In particular, the mJPEG utility.

I have three SDSS FITS, cutouts created by GALFIT, all the same size, all centered on the same object; mJPEG gets upset: "Red and green FITS images don't match." From the detailed dump, I see that the values for crval1, crval2, crpix1, crpix2, and crota2 are not the same, in the two FITS ('red' and 'green'; I expect the same mismatch for 'blue').

What are these parameters? Which ones need to be the same, for mJPEG to work? How to create a (set of) FITS with values that mJPEG will accept?

Of course, I can simply edit two FITS headers, copying the values of these five parameters from the third (and this will no doubt work, sorta), but I'd *much* prefer to know what I'm doing ...

The mJPEG tool requires all the files to have the same WCS information. That means all of the CR... keys must have the same values, and possibly some of the other, non-WCS entries (EPOCH, LAT, LONG) that might be used by the WCS engine. You can see the FITS standard for a list of WCS keywords.

You can try forcing all the header values to match. The fact that they don't suggests there might be a fundamental alignment issue, so your results may be less than perfect. Have you tried a more simple approach, like just combining the layers in Photoshop?
Chris

*****************************************
Chris L Peterson
Cloudbait Observatory
http://www.cloudbait.com

JeanTate
Science Officer
Posts: 113
Joined: Wed Sep 08, 2010 12:35 am

Re: Anyone familiar with Montage?

Postby JeanTate » Tue Feb 05, 2013 12:14 am

Thank you Chris.
Chris Peterson wrote:
JeanTate wrote:In particular, the mJPEG utility.

I have three SDSS FITS, cutouts created by GALFIT, all the same size, all centered on the same object; mJPEG gets upset: "Red and green FITS images don't match." From the detailed dump, I see that the values for crval1, crval2, crpix1, crpix2, and crota2 are not the same, in the two FITS ('red' and 'green'; I expect the same mismatch for 'blue').

What are these parameters? Which ones need to be the same, for mJPEG to work? How to create a (set of) FITS with values that mJPEG will accept?

Of course, I can simply edit two FITS headers, copying the values of these five parameters from the third (and this will no doubt work, sorta), but I'd *much* prefer to know what I'm doing ...

The mJPEG tool requires all the files to have the same WCS information. That means all of the CR... keys must have the same values, and possibly some of the other, non-WCS entries (EPOCH, LAT, LONG) that might be used by the WCS engine. You can see the FITS standard for a list of WCS keywords.

What's odd is that the FITS used by GALFIT were extracted from three SDSS FITS using Montage's mSubimage module, with identical input (RA, Dec, size) values!

You can try forcing all the header values to match.

Yes, that's easy enough to do ... but I'm really quite interested in why the values are different, and how I can force them to match in a way that ensures each of the RGB pixels will come from as close to the same points on the sky as possible.

The fact that they don't suggests there might be a fundamental alignment issue, so your results may be less than perfect. Have you tried a more simple approach, like just combining the layers in Photoshop?

No. For starters, I do not have Photoshop (nor any desire to get it); more importantly, I'm more interested - for now - in learning why mJPEG is getting indigestion, and how I can make it happy, without doing silly things.

User avatar
Chris Peterson
Abominable Snowman
Posts: 13277
Joined: Wed Jan 31, 2007 11:13 pm
Location: Guffey, Colorado, USA

Re: Anyone familiar with Montage?

Postby Chris Peterson » Tue Feb 05, 2013 12:28 am

JeanTate wrote:
You can try forcing all the header values to match.

Yes, that's easy enough to do ... but I'm really quite interested in why the values are different, and how I can force them to match in a way that ensures each of the RGB pixels will come from as close to the same points on the sky as possible.

Well, it's pretty unusual to have any two FITS images with matching WCS data. Even the most microscopic shift in position or rotation between the images will result in different WCS values. What I'd expect a layering/stacking tool to do is to utilize the WCS information in the header in order to manage the alignment. That's what all the software I use does.
Chris

*****************************************
Chris L Peterson
Cloudbait Observatory
http://www.cloudbait.com

JeanTate
Science Officer
Posts: 113
Joined: Wed Sep 08, 2010 12:35 am

Re: Anyone familiar with Montage?

Postby JeanTate » Tue Feb 05, 2013 3:20 am

Thanks again Chris.

Reading the FITS standard (per the link you posted), together with the key words in the FITS header, I have most of what I need to make sense of all this.

In particular, CTYPE1 is 'RA---TAN'; CTYPE2 'DEC--TAN'; CUNIT1 (and 2) is 'deg'; CRVAL1 and 2 make sense as RA and DEC, expressed in degrees; and CDi_j as the elements of a 2 X 2 matrix, whose elements have the dimension degrees per pixel. Further, "The algorithm to be used to define the spherical projection must be encoded in the CTYPEi keyword as the three-letter algorithm code, the allowed values for which are specified in Table 23 and defined in references Calabretta & Greisen (2002) and Calabretta & Roukema (2007)." Table 23 tells me that the code "TAN" has properties detailed in section 5.1.3 of Calabretta & Greisen (2002), and is a "Gnomonic" projection. Which is all well and good ... except that there is no section 5.1.3 in Calabretta & Greisen (2002)! :shock: And that reference is skimpy indeed on projections in general.

What I am missing, therefore, is a definition of the particular gnomonic projection used, and thus the formula(e) to be used to do the final step (or the specific algorithm).

Any ideas?

JeanTate
Science Officer
Posts: 113
Joined: Wed Sep 08, 2010 12:35 am

Re: Anyone familiar with Montage?

Postby JeanTate » Tue Feb 05, 2013 3:46 am

The reference in the FITS standard document is incorrect! :o :shock:

It is "Greisen, E.W. & Calabretta, M. R. 2002, A&A, 395, 1061", which is entitled "Representations of world coordinates in FITS"; the correct reference is "Greisen, E.W. & Calabretta, M. R. 2002, A&A, 395, 1077", which is entitled "Representations of celestial coordinates in FITS". Now all I need is how to transform between the particular gnomonic projection and spherical coordinates RA and Dec ...


Return to “The Library: Information Desk and Educational Resources”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 1 guest