jacopo-chevallard / BEAGLE-general

Basic information to get started with the galaxy spectral modelling tool Beagle
https://www.iap.fr/beagle/
9 stars 0 forks source link

Content of example photometry fits file? #44

Closed rmastand closed 7 years ago

rmastand commented 7 years ago

I attempted to run the program BEAGLE-general/scripts/plot_Beagle_SED.py with BEAGLE-general/example-results/fitting_example/1_BEAGLE.fits.gz and got the following error:

$ python plot_Beagle_SED.py --file ../example_results/fitting_example/1_BEAGLE.fits.gz 
--->  None
Traceback (most recent call last):
  File "plot_Beagle_SED.py", line 46, in <module>
    wl = hdulist['full sed wl'].data['wl'][0,:] / 1.E+04
  File "/Users/RMastandrea/Library/Python/2.7/lib/python/site-packages/astropy/io/fits/hdu/hdulist.py", line 314, in __getitem__
    self._positive_index_of(key))
  File "/Users/RMastandrea/Library/Python/2.7/lib/python/site-packages/astropy/io/fits/hdu/hdulist.py", line 702, in _positive_index_of
    index = self.index_of(key)
  File "/Users/RMastandrea/Library/Python/2.7/lib/python/site-packages/astropy/io/fits/hdu/hdulist.py", line 683, in index_of
    raise KeyError('Extension {} not found.'.format(repr(key)))
KeyError: "Extension 'full sed wl' not found."
Radhas-MBP:scripts RMastandrea$ python plot_Beagle_SED.py --file ../example_results/fitting_example/1_BEAGLE.fits.gz --row 0
--->  None
Traceback (most recent call last):
  File "plot_Beagle_SED.py", line 46, in <module>
    wl = hdulist['full sed wl'].data['wl'][0,:] / 1.E+04
  File "/Users/RMastandrea/Library/Python/2.7/lib/python/site-packages/astropy/io/fits/hdu/hdulist.py", line 314, in __getitem__
    self._positive_index_of(key))
  File "/Users/RMastandrea/Library/Python/2.7/lib/python/site-packages/astropy/io/fits/hdu/hdulist.py", line 702, in _positive_index_of
    index = self.index_of(key)
  File "/Users/RMastandrea/Library/Python/2.7/lib/python/site-packages/astropy/io/fits/hdu/hdulist.py", line 683, in index_of
    raise KeyError('Extension {} not found.'.format(repr(key)))
KeyError: "Extension 'full sed wl' not found."

Further, when checking the information in the file (using the astropy fits.info function), the file seems to contain:

Filename: 1_BEAGLE.fits.gz
No.    Name         Type      Cards   Dimensions   Format
  0  PRIMARY     PrimaryHDU       6   ()      
  1  GALAXY PROPERTIES  BinTableHDU     47   495R x 14C   [1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E]   
  2  STAR FORMATION  BinTableHDU     22   495R x 5C   [1E, 1E, 1E, 1E, 1E]   
  3  STAR FORMATION BINS  BinTableHDU     28   495R x 7C   [1E, 1E, 1E, 1E, 1E, 1E, 1E]   
  4  DUST ATTENUATION  BinTableHDU     31   495R x 9C   [1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E]   
  5  NEBULAR EMISSION  BinTableHDU    407   495R x 134C   [1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E]   
  6  MARGINAL PHOTOMETRY  BinTableHDU     33   495R x 8C   [1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E]   
  7  ABSOLUTE MAGNITUDES  BinTableHDU     33   495R x 8C   [1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E]   
  8  APPARENT MAGNITUDES  BinTableHDU     33   495R x 8C   [1E, 1E, 1E, 1E, 1E, 1E, 1E, 1E]   
  9  POSTERIOR PDF  BinTableHDU     23   495R x 7C   [1E, 1E, 1E, 1E, 1E, 1E, 1E]   

none of which looks like redshift or mass results, which is what the photometry is fitting for.

Is this simply because I'm using an example file?

jacopo-chevallard commented 7 years ago

To post-process Beagle output files you should rather use PyP-Beagle (you should have received a message from the Beagle mailing list earlier today). Try to use PyP-Beagle, and if you encounter problems open an issue on the PyP-BEAGLE repo.

To answer your specific question

Is this simply because I'm using an example file?

the answer is yes, the script that you're trying to use above allows you to plot the SED output from Beagle. To get the full SED in the output FITS file, however, you must set

PRINT SPECTRUM = T

in the parameter file, while in the example file is set to F (to save disk space).

Also, I would suggest you to use fv to take a look at the FITS file output from Beagle. It is a multi-extension file composed of FITS tables and FITS images, with a lot of information inside.