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

errors when including AGN models in BEAGLE #104

Open hollisakins opened 1 year ago

hollisakins commented 1 year ago

I’ve been successful running BEAGLE with the typical SFH+nebular models, but running into some issues when trying to add in the Type II AGN NLR templates. I just took my existing .param file, (a modified version of fit_photometry_example.param) and added the following parameters:

# ************ AGN line emission ************
PARAMETER  = name:agn_lacc type:fitted  order_priority:0    prior:distribution:uniform   prior:range:[40,48]    
PARAMETER  = name:agn_xi   type:fixed    value:0.3
PARAMETER  = name:agn_logU   type:fixed    value:-2
PARAMETER  = name:agn_Z    type:fixed  value:0

This ran up until the start of MultiNest sampling (generating live points) and then crashed with

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
Could not print backtrace: executable file is not ELF

With no backtrace I wasn't able to diagnose the issue myself. I doubt that this is due to insufficient memory being allocated to Docker (I've given it 24gb). Is it possible that there are some additional templates or parameters needed in order to run BEAGLE-AGN?

If there's not an obvious solution here I can upload my input files.

jacopo-chevallard commented 1 year ago

hi @hollisakins yes indeed, I think that @eclake or @AlbaVidal can send you an example parameter file with AGN NLR models, as well as a link to the templates

hollisakins commented 1 year ago

that would be great!

hollisakins commented 1 year ago

Just adding this here: I was able to locate the AGN NLR template files thanks to Emma, but on my first run I encountered this error: named column not found "Mg10@610_609.789978” It seems like the columns in the fits template files are named differently than beagle expects? Has this issue been encountered before? Is there an easy way to resolve this?

I also tried to conduct a test just running beagle in mock mode, with the following param file:

[main]
VERBOSE = 3
SEED = 123
HUBBLE_0 =
OMEGA_MATTER = 
OMEGA_LAMBDA =

#************************* TEMPLATES  ***************************

TEMPLATES NEBULAR = $BEAGLE_TEMPLATES/ineb_June16/mup100/cb2016_n2_mup100_N015_O01_deplO70_C100_June16.txt
EMISSION LINES CONFIGURATION = $BEAGLE_TEMPLATES/ineb_June16/mup100/cb2016_Jan16_line_wavelengths_may2017.dat
TEMPLATES AGN = $BEAGLE_TEMPLATES/agn_nlr_May2020/nlr_fits_May2020_list.dat

#********************** PRINTED OUTPUT **************************

RESULTS DIRECTORY = $BEAGLE_RESULTS/agn_mock_test/
PRINT PHOTOMETRY = F
PRINT SPECTRUM = T
PRINT SPECTRAL INDICES = F
PRINT SF AND ChE HISTORIES = F

#******************** FITTING PARAMETERS  ***********************

PARAMETER  = name:redshift     type:fixed   value:5

SF_PARAMETER  = name:sfh_type                 type:fixed  char_value:constant
SF_PARAMETER  = name:max_stellar_age          type:fixed     value:7.5
SF_PARAMETER  = name:metallicity              type:fixed     value:-1
SF_PARAMETER  = name:mass                     type:fixed     value:10
SF_PARAMETER  = name:sfr                      type:fixed     value:2

PARAMETER = name:agn_lacc type:fixed value:45
PARAMETER = name:agn_logU type:fixed value:-2
PARAMETER = name:agn_xi type:fixed value:0.3
PARAMETER = name:agn_Z type:dependent

Which returned the same error:

 [ERROR: CFITSIO error number          219 ---> named column not found "Mg10@610_609.789978" ]
 [FUNCTION: "cfitsio_print_error" ]
 [MODULE: "fits_io" ]
 [BACKTRACE:

Could not print backtrace: executable file is not ELF
#0  0x4002e37b0e
#1  0x40002fdc99
#2  0x40002fe2cb
#3  0x40002f55db
#4  0x40002b476e
#5  0x40004c0880
#6  0x4000460fb7
#7  0x400005d266
#8  0x400005aca6
#9  0x4003221d8f
#10  0x4003221e3f
#11  0x400005bb94
#12  0xffffffffffffffff
rmendsley commented 1 year ago

Hello, I just wanted to check if there's been any update to this. I'm getting the same error shown below when I try using the BEAGLE AGN templates with an example parameter file that was provided to me. Thanks!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 [ERROR: CFITSIO error number          219 ---> named column not found "Mg10@610_609.789978" ]
 [FUNCTION: "cfitsio_print_error" ]
 [MODULE: "fits_io" ]
 [BACKTRACE:

Could not print backtrace: executable file is not ELF
#0  0x4002fcdd3a
#1  0x400033fc21
#2  0x4000340b0a
#3  0x4000335c5d
#4  0x40002e3d0f
#5  0x40005685fe
#6  0x40004fbddf
#7  0x400005d1a8
#8  0x400005ad36
#9  0x40034340b2
#10  0x400005bc2d
#11  0xffffffffffffffff
 ]
 [ ***************************************** ]
 [ ----> EXITING FUNCTION / SUBROUTINE <---- ]
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 [ ***** STOPPING PROGRAM ***** ]
jacopo-chevallard commented 1 year ago

@AlbaVidal or @eclake can you, please, provide any guidance to @hollisakins and @rmendsley about the error they aer encountering?

eclake commented 1 year ago

Hi @hollisakins @rmendsley - I'm sorry for the slow reply. some of this issue has been addressed in an e-mail thread with @AlbaVidal, An error with a line label containing '@' means that the EMISSION LINES CONFIGURATION file needs to change. Here is one that I have used successfully recently.

cb2016_n2_mup100_N015_O01_deplO70_C100_Jan16_line_wavelengths_may2017_sensibleLables.dat.zip

Please can I double check for each of you which AGN_NLR templates you are using - in principle you can open these files in topcat and see if the line label it's complaining about is, indeed missing or it's just a difference in the format of the label. Here is a screenshot of one of the template files line labels, can you verify yours look similar, please?

image
rmendsley commented 1 year ago

Hi @eclake thanks for the file! Using that emission lines configuration file, that resolved the issue complaining about Mg10. But now I get this error. It's not clear to me if this is directly related and arising from the same general issue? I'm using docker v0.28.0. Attached is my parameter file (where cb2016_AGN_lineList.dat is the file you sent in the previous message) if that's helpful. Please let me know if anything else would be good to have.

At line 457 of file /home/runner/work/BEAGLE/BEAGLE/src/handle_templates.f90
Fortran runtime error: Index '1' of dimension 1 of array 'templates%dwl_region' below lower bound of 274880959983

Error termination. Backtrace:

Could not print backtrace: executable file is not ELF
#0  0x4002e37b0e
#1  0x4002e38649
#2  0x4002e38c46
#3  0x40004abbbb
#4  0x4000461544
#5  0x400005d268
#6  0x400005aca6
#7  0x4003221d8f
#8  0x4003221e3f
#9  0x400005bb94
#10  0xffffffffffffffff

paramFile.txt

jacopo-chevallard commented 1 year ago

@rmendsley where did you get the AGN templates from?

eclake commented 1 year ago

@rmendsley - I don't think this is your problem, but looking at your parameter file, Calzetti doesn't currently work for BEAGLE-AGN (bug fix coming) - only CF00.

I should be able to try and set things up for reproducing your bug early next week, I'm sorry for the delay.

Also, the backtrace looks very different to what we normally get output from docker, is it normal that it points towards /home/runner/work/BEAGLE/BEAGLE/src/ when you run docker? Or did you manage to compile locally?

rmendsley commented 1 year ago

@jacopo-chevallard I grabbed the AGN templates from the link you sent me a couple weeks ago. Are those ok?

And sounds good @eclake , I appreciate your time! I have tried compiling BEAGLE locally on my machine but haven't been able to complete that yet. There's no /home/runner/ directory on my machine -- it's in ~/work/BEAGLE/install so I don't see how that would be the source of the issue. BEAGLE runs fine (just super slow) on docker when I use just the star-forming models.

jacopo-chevallard commented 1 year ago

@rmendsley yes they are the correct ones, can you run a last test, i.e. trying to run with version 0.24.3?

rmendsley commented 1 year ago

@jacopo-chevallard with v0.24.3, I get this error message.

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:

Could not print backtrace: executable file is not ELF
#0  0x4003762eea
#1  0x40037620dd
#2  0x400406ef1f
#3  0x400044b85d
#4  0x4000408031
#5  0x4000057b84
#6  0x4000055646
#7  0x4004051b96
#8  0x4000056569
#9  0xffffffffffffffff
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
jacopo-chevallard commented 1 year ago

@AlbaVidal do you have any hint for @rmendsley? You are using Beagle v0.24.3 to run the AGN templates, right? Can you post here an example of the different input files you're using? (you can grab the entire BEAGLE-input-files folder of a successful fit, just removing the input data catalogue)

AlbaVidal commented 1 year ago

Hi, I copy here a param file that works for me with that version. You should update the paths of the templates and the results and the spectral indices catalog and configuration files to make it work.

#Seed for the random number generator
SEED = 994188
VERBOSE = 2

#****************************************************************
#******************* TEMPLATES ********************************
#****************************************************************

TEMPLATES NEBULAR = $BEAGLE_TEMPLATES/ineb_June16/mup100/cb2016_n2_mup100_N015_O01_deplO70_C10_to_C100_June16
EMISSION LINES CONFIGURATION = /nethome/vidal/beagle/files/param/beagleagn/cb2016_n2_mup300_N015_O01_deplO70_C100_Jan16_line_wavelengths_jun2020.dat
TEMPLATES AGN = /nethome/vidal/beagle/files/param/beagleagn/withoiinohalpha/newtests/agn_nlr_Mar19/nlr_list.dat

SHRINK TEMPLATES WL RANGE = 900 60000
#REBIN TEMPLATES = 10

#****************************************************************
#******************* INPUT & LINES *****************************
#****************************************************************

SPECTRAL INDICES CATALOGUE = mycatalog.fits
SPECTRAL INDICES CONFIGURATION = myspectralindicesconfiguration.dat

#PRIORS CATALOGUE = $BEAGLE_DATA/emission_lines_Type2_AGN_June2020_narrow_quaderr_noUL.fits
#PRIORS CATALOGUE DESCRIPTION = object_ID:colName:ID

#****************************************************************
#******************* DUST ATTENUATION **************************
#****************************************************************

IGM ABSORPTION = Inoue

File containing set of radiativa transfer (RT) calculations of dust attenuation of starlight
#RT CALCULATIONS = Tuffs_bulge_NEW-28-11.dat Tuffs_thick_NEW-28-11.dat Tuffs_thin_NEW-28-11.dat
#RT COMPONENTS NAMES = bulge thick_disc thin_disc

#**************************************************************
#************** SF BIN #1 *************************************
#**************************************************************
SF_PARAMETER = name:sfh_type type:fixed char_value:constant
SF_PARAMETER = name:metallicity type:fixed value:-0.7 # in log(Z/Z_sun)
SF_PARAMETER = name:max_stellar_age type:fixed value:8.7
SF_PARAMETER = name:sfr type:fixed value:-8.0 # In log(M_sun/yr)

#**************************************************************
#************** AGN PARAMETERS *******************************
#**************************************************************
PARAMETER = name:agn_lacc type:fitted prior:distribution:uniform prior:range:[38,55]
PARAMETER = name:agn_logU type:fitted prior:distribution:uniform prior:range:[-4,-1.5]
PARAMETER = name:agn_xi type:fitted order_priority:1 prior:distribution:uniform prior:range:[0.1,0.5]
PARAMETER = name:agn_Z type:fitted prior:distribution:uniform prior:range:[-2,0.3]

#**************************************************************
#************** NEBULAR PARAMETERS ***************************
#**************************************************************
PARAMETER = name:nebular_logU type:fixed value:-2.
PARAMETER = name:nebular_xi type:fixed value:0.3
PARAMETER = name:nebular_Z type:dependent

#**************************************************************
#************** ATTENUATION PARAMETERS ***********************
#**************************************************************
PARAMETER = name:attenuation_type type:fixed char_value:CF00 # values can be: CF00, Calzetti, CCWW13_universal, CCWW13_full
PARAMETER = name:tauV_eff type:fitted order_priority:0 prior:distribution:uniform prior:range:[0.,8.]
PARAMETER = name:mu type:fixed value:0.4 #type:fitted order_priority:0 prior:distribution:uniform prior:range:[0.0,1.0]

#**************************************************************
#************** OTHER PARAMETERS *****************************
#**************************************************************
PARAMETER = name:redshift type:fixed value:0.0

#****************************************************************
#******************* PRINTED OUTPUT ***************************
#****************************************************************

RESULTS DIRECTORY = myresultsdirectory

PRINT PHOTOMETRY = F
PRINT SPECTRUM = T
PRINT SPECTRAL INDICES = T
PRINT SF AND ChE HISTORIES = F
PRINT AGN SPECTRUM = T
ACCOUNT FOR HII DUST = T
rmendsley commented 1 year ago

Thanks @AlbaVidal ! The code seems to be working now after changing all of the parameters to what you had specified. I'll start with the current param file and make changes back to the desired parameter setup. Hopefully it works out in the end. I'll send an update later.

jacopo-chevallard commented 1 year ago

great, thanks a lot @AlbaVidal !

AlbaVidal commented 1 year ago

That's great that this param file works, then you can trace back which combination of your parameters was crashing adding up little by little. You have in the param file examples of how to set up fixed and fitted parameters but let me know if you need something else.