threeML / hawc_hal

HAWC Accelerated Likelihood - python-only framework for HAWC data analysis
BSD 3-Clause "New" or "Revised" License
11 stars 21 forks source link

HAL get_simulated_dataset does not update name of BKG model #95

Open sergiohcdna opened 5 months ago

sergiohcdna commented 5 months ago

Description When using get_simulated_dataset, the new HAL instance keep the name of the original instance for the Background normalization model

MWE and error

For any maptree and detector response:

hawc = HAL("HAWCCR",maptree,detres,roi)
hawc.set_active_measurements(bin_list=analysis_bins)
hawc.set_model(this_likelihood_model)

simhawc = hawc.get_simullated_dataset('SimHAWC')
thisdata = DataList(simhawc)

njl = JointLikelihood(this_likelihood_model,thisdata,verbose=False)
par,stats = njl.fit(quiet=True)

 ERROR     This is a bug of the plugin for <class 'hawc_hal.HAL.HAL'>: nuisance     joint_likelihood.py:137
                  parameters must contain the instance name 

If I check the _nuisance_parameters dict, I get:

simhawc._nuisance_parameters

OrderedDict([('HAWCCR_bkg_renorm',
              Parameter HAWCR_bkg_renorm = 1.0 []
              (min_value = 0.5, max_value = 1.5, delta = 0.01, free = False))])

Expected behavior

simhawc._nuisance_parameters

OrderedDict([('SimHAWC_bkg_renorm',
              Parameter SimHAWC_bkg_renorm = 1.0 []
              (min_value = 0.5, max_value = 1.5, delta = 0.01, free = False))])

Desktop (UMD-Fiesta)