Feature #3469

Add GModelAssociation and GModelAssociations classes

Added by Knödlseder Jürgen about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:11/26/2020
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:2.0.0
Duration:

Description

The GModelAssociation class should store source association information for a given model. The method shall read and write the source information from or into an XML file. A possible XML format is:

<source name="Source_001" type="PointSource">
    <spectrum type="PowerLaw">
        ...
    </spectrum>
    <spatialModel type="PointSource">
        ....
    </spatialModel>
    <associations>
        <association name="Crab">
            <property name="RA" value="83.6331"/>
            <property name="DEC" value="22.0145"/>
            <property name="distance" value="0.0123"/>
            <property name="probability" value="0.978"/>
        </association>
    </associations>
</source>

Instances of GModelAssociation are gathered in a GModelAssociations container class that organises the reading and writing of the information. As for models, association names in a container shall be unique.


Recurrence

No recurrence.

History

#3 Updated by Knödlseder Jürgen about 4 years ago

  • Status changed from New to Pull request
  • Assigned To set to Knödlseder Jürgen
  • % Done changed from 0 to 90

I implemented the GModelAssociation and GModelAssociations classes and added an instance of GModelAssociations as a member to the GModel class.

I added GModel::associations() getter and setter methods to access the associations. The associations are also automatically written in the GModel::read_attributes() and GModel::write_attributes() methods, and the association names are displayed by GModel::print_attributes().

Below is the content of the test/data/crab_associations.xml file to illustrate the XML format of the associations.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<source_library title="source library">
  <source name="1FGL J0005.7+3815" type="PointSource" instrument="LAT,CTA" id="000001" ts="100.100" tscalc="1">
    <spectrum type="PowerLaw">
      <parameter name="Prefactor" value="1.73" error="0" scale="1e-07" min="1e-07" max="1000" free="1" />
      <parameter name="Index" value="-2.1" error="0" scale="1" min="-5" max="5" free="1" />
      <parameter name="PivotEnergy" value="100" scale="1" min="10" max="1000000" free="0" />
    </spectrum>
    <spatialModel type="PointSource">
      <parameter name="RA" value="83.6331" scale="1" min="-360" max="360" free="0" />
      <parameter name="DEC" value="22.0145" scale="1" min="-90" max="90" free="0" />
    </spatialModel>
    <scaling>
      <instrument name="LAT" value="1.1" scale="1" min="0.1" max="10" free="0" />
      <instrument name="CTA" value="0.5" scale="1" min="0.1" max="10" free="0" />
    </scaling>
    <associations>
      <association name="Crab nebula">
        <property name="RA" value="83.6331" />
        <property name="DEC" value="22.0145" />
      </association>
      <association name="Crab pulsar">
        <property name="RA" value="83.6331" />
        <property name="DEC" value="22.0145" />
      </association>
    </associations>
  </source>
</source_library>

#4 Updated by Knödlseder Jürgen about 4 years ago

  • Status changed from Pull request to Closed
  • % Done changed from 90 to 100

Merged into devel.

Also available in: Atom PDF