Open jballet opened 5 months ago
Hi Jan, I do nốt have the file "merge_sources.py" can you send it to me, I can have a look to check the compatibility with the create_from_xml method.
Hi Nicola, You don't really need the merge_sources.py file to solve this. All that is required is support the ConstantValue spectral type. The attached file contains the merge_sources.py script and the FixedSources_template.xml file with the ConstantValue spectral type.
Thanks! In think I know what I need to do, but it will require small changes in several files. I'll work on this (not top priority though...)
Feature Request
Is your feature request related to a problem? Please describe. Eric Charles has a very useful utility called merge_sources.py that takes a (potentially long) XML source file and generates a source map that can be appended to an existing source map file and later used as a diffuse source. This is very convenient because it saves the trouble of generating over and over the background of fixed point sources in the outer parts of a ROI, while avoiding the enormous size of creating one source map per source. It is easy to add that source map to an existing fermipy source map. However, a later call fails because the type of DiffuseSource entry in the XML file is not foreseen. File ".../site-packages/fermipy/roi_model.py", line 1179, in create_from_xml {'Spectrum_Filename': spec['file'], KeyError: 'file' The source model is simply entered as everything constant
Describe the solution you'd like Just support this and enter it as part of the diffuse model.
Describe alternatives you've considered A workaround is to cheat and make the model appear as spectrum type="FileFunction" pointing to a constant file.