Commit 8139b97c47826ecff487fe5c5c179f8bdeae7174

Authored by Jürgen Knödlseder
1 parent f3e9721d

Correct identifier writing.

The attribute for identifiers is "id". This has been corrected in GCTAModelBackground. Further, writing of the attribute has been added to GModelSky. Attributes are also only written if the identifier string is not empty.
ChangeLog
1   -2014-01-21 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
  1 +2014-01-22 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2  
3 3 * Bug fix Version 0.8.1 released
4 4 ================================
5 5  
6 6 Added missing hyphens in pfiles synchronisation section (#1091)
7 7 Add configuration test script (#1091)
8   - GCTAModelBackground writes out run ids in XML file (#1092)
9   -
  8 + GModelSky, GCTAModelBackground and GCTAModelRadialAcceptance write
  9 + id attribute into XML file (#1092)
10 10  
11 11 2014-01-18 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
12 12  
... ...
... ... @@ -2,7 +2,7 @@ New Features and Important Changes in GammaLib 00-08-01
2 2  
3 3 Author(s) : Juergen Knoedlseder
4 4  
5   -21 January 2014
  5 +22 January 2014
6 6  
7 7  
8 8 1. Introduction
... ... @@ -49,7 +49,8 @@ None
49 49  
50 50 8. Model module
51 51 ---------------
52   -None
  52 +The GModelSky class now writes the id attribute to the XML file in case
  53 +that identifiers are specified.
53 54  
54 55  
55 56 9. Numerics module
... ... @@ -109,7 +110,10 @@ None
109 110  
110 111 20. CTA interface
111 112 -----------------
112   -None
  113 +The GCTAModelBackground and GCTAModelRadialAcceptance classes now write
  114 +the id attribute to the XML file in case that identifiers are specified.
  115 +Furthermore, GCTAModelRadialAcceptance no longer write the temporal
  116 +model component.
113 117  
114 118  
115 119 21. COMPTEL interface
... ...
inst/cta/src/GCTAModelBackground.cpp
1 1 /***************************************************************************
2 2 * GCTAModelBackground.cpp - Generic CTA background model class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2013 by Michael Mayer *
  4 + * copyright (C) 2013-2014 by Michael Mayer *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -846,10 +846,13 @@ void GCTAModelBackground::write(GXmlElement&amp; xml) const
846 846 // Set model type, name and optionally instruments
847 847 src->attribute("name", name());
848 848 src->attribute("type", type());
849   - src->attribute("ids",ids());
850 849 if (instruments().length() > 0) {
851 850 src->attribute("instrument", instruments());
852 851 }
  852 + std::string identifiers = ids();
  853 + if (identifiers.length() > 0) {
  854 + src->attribute("id", identifiers);
  855 + }
853 856  
854 857 // Write spectral model
855 858 if (spectral() != NULL) {
... ...
inst/cta/src/GCTAModelRadialAcceptance.cpp
1 1 /***************************************************************************
2 2 * GCTAModelRadialAcceptance.cpp - Radial acceptance model class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2011-2013 by Juergen Knoedlseder *
  4 + * copyright (C) 2011-2014 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -714,6 +714,7 @@ void GCTAModelRadialAcceptance::write(GXmlElement&amp; xml) const
714 714 src = xml.append("source");
715 715 if (spectral() != NULL) src->append(GXmlElement("spectrum"));
716 716 if (radial() != NULL) src->append(GXmlElement("radialModel"));
  717 + //if (temporal() != NULL) src->append(GXmlElement("temporalModel"));
717 718 }
718 719  
719 720 // Set model type, name and optionally instruments
... ... @@ -722,6 +723,10 @@ void GCTAModelRadialAcceptance::write(GXmlElement&amp; xml) const
722 723 if (instruments().length() > 0) {
723 724 src->attribute("instrument", instruments());
724 725 }
  726 + std::string identifiers = ids();
  727 + if (identifiers.length() > 0) {
  728 + src->attribute("id", identifiers);
  729 + }
725 730  
726 731 // Write spectral model
727 732 if (spectral() != NULL) {
... ... @@ -736,12 +741,14 @@ void GCTAModelRadialAcceptance::write(GXmlElement&amp; xml) const
736 741 }
737 742  
738 743 // Write temporal model
  744 + /*
739 745 if (temporal()) {
740 746 if (dynamic_cast<GModelTemporalConst*>(temporal()) == NULL) {
741 747 GXmlElement* temp = src->element("lightcurve", 0);
742 748 temporal()->write(*temp);
743 749 }
744 750 }
  751 + */
745 752  
746 753 // Return
747 754 return;
... ...
src/model/GModelSky.cpp
... ... @@ -738,6 +738,10 @@ void GModelSky::write(GXmlElement&amp; xml) const
738 738 if (instruments.length() > 0) {
739 739 src->attribute("instrument", instruments);
740 740 }
  741 + std::string identifiers = ids();
  742 + if (identifiers.length() > 0) {
  743 + src->attribute("id", identifiers);
  744 + }
741 745  
742 746 // Write spectral model
743 747 if (spectral() != NULL) {
... ...