Action #761

Feature #754: Allow fitting of elliptical morphology shapes

Implement GModelSpatialEllipticalDisk class

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

Status:ClosedStart date:02/16/2013
Priority:NormalDue date:02/22/2013
Assigned To:Mayer Michael% Done:

100%

Category:-Estimated time:10.00 hours
Target version:1.0.0
Duration: 7

Description

The GModelSpatialEllipticalDisk class implements a spatial model representing an elliptical disk. The model has 5 parameters:
  • Ellipse centre (2 parameters)
  • Position angle
  • Major and minor axes (2 parameters)

model_ellipse_pa45.png (63 KB) Knödlseder Jürgen, 02/23/2013 05:25 AM

Model_ellipse_pa45

Recurrence

No recurrence.

History

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

  • Target version set to HESS sprint #1

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

  • Subject changed from Implement GModelEllipticalDisk class to Implement GModelSpatialEllipticalDisk class
  • Description updated (diff)

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

I propose the following XML interface for an elliptical disk model (the spectrum part is simply for illustration):


  <source name="Crab(disk)" type="ExtendedSource">
    <spectrum type="PowerLaw">
       <parameter name="Prefactor" scale="1e-16" value="5.7"  min="1e-07" max="1000.0" free="1"/>
       <parameter name="Index"     scale="-1"    value="2.48" min="0.0"   max="+5.0"   free="1"/>
       <parameter name="Scale"     scale="1e6"   value="0.3"  min="0.01"  max="1000.0" free="0"/>
    </spectrum>
    <spatialModel type="EllipticalDisk">
      <parameter name="RA"          scale="1.0" value="83.6331" min="-360" max="360" free="1"/>
      <parameter name="DEC"         scale="1.0" value="22.0145" min="-90"  max="90"  free="1"/>
      <parameter name="PA"          scale="1.0" value="45.0"    min="-360" max="360"  free="1"/>
      <parameter name="MajorRadius" scale="1.0" value="1.00"    min="0.01" max="10"  free="1"/>
      <parameter name="MinorRadius" scale="1.0" value="0.50"    min="0.01" max="10"  free="1"/>
    </spatialModel>
  </source>

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

  • Assigned To set to Mayer Michael

#5 Updated by Mayer Michael about 11 years ago

  • Status changed from New to In Progress

#6 Updated by Mayer Michael about 11 years ago

  • % Done changed from 0 to 70

Class implementation almost finished... The only thing left is that I am still trying to find a way to implement the mc() - method.

By the way: I found a copy and paste issue in GModelSpatialElliptical::init_members(): At “Initialise Position Angle” there should be m_posangle initialised and not m_dec again :) . Is that a separate issue, or could it be combined with the commit of GModelSpatialEllipticalDisk?

And also, we should think about different names of the radial models: E.g. “DiskFunction” → “RadialDisk” for GModelSpatialRadialDisk

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

Michael Mayer wrote:

Class implementation almost finished... The only thing left is that I am still trying to find a way to implement the mc() - method.

Great. For MC, in the worst case you may simply use a rejection method.

By the way: I found a copy and paste issue in GModelSpatialElliptical::init_members(): At “Initialise Position Angle” there should be m_posangle initialised and not m_dec again :) . Is that a separate issue, or could it be combined with the commit of GModelSpatialEllipticalDisk?

For tiny things like this I recommend to just correct the bug and commit. In particular, no one is using so far the functionality, so no need to keep track of it in the tracker.

And also, we should think about different names of the radial models: E.g. “DiskFunction” → “RadialDisk” for GModelSpatialRadialDisk

I fully agree. Maybe we can start a discussion about this on the forum. I invented the names in analogy to Fermi-LAT, but they are badly chosen. We may want to define better names.

I was even planning to discuss with Jim Chiang about this, one of the core developers of the Fermi ScienceTools. It would be nice if we could find a common strategy for naming conventions, which would help to make this more compatible.

Another aspect is the virtual observatory: Ultimately, I would like to have models in a VO compliant format, but I’m not some that anything exists so far. I still need to learn more about VO formats, but in thinking about the XML format it would be nice to keep also this aspect in mind.

So before releasing a new version of GammaLib we probably want to clean up a bit the XML interface. I’m actually doing the very same thing for the C++ interface (see #692) with the aim to have a homogenous and stable interface that won’t be changed much in the future. This is quite a big task, but we better do this earlier than later.

#8 Updated by Mayer Michael about 11 years ago

  • Due date set to 02/22/2013
  • Status changed from In Progress to Pull request
  • % Done changed from 70 to 100
  • Estimated time set to 10.00
  • Remaining (hours) set to 0.0

GModelSpatialEllipticalDisk should be finished. The mc-method is kind of preliminary and needs to be checked. Currently we draw a random position from a radialdisk with the major axis as radius and reject the it when the position is outside of the ellipse. I am very sure that there is a better (and more efficient) solution.
I still left some @todos in the documentation, because I am off next week. They could be fixed afterwards :)

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

Great!

I started to work on the integration and stumbled over this: https://github.com/pokerth/pokerth/pull/166. In fact, the integration failed on FreeBSD, and the link explains why. minor() and major() are predefined macros. So we can’t use them as methods! Here you see the power of a continuous integration system, you find really weired bugs in a few minutes. See: https://cta-jenkins.irap.omp.eu/job/gammalib-integrate-os/55/

I propose to remplace both names by semimajor() and semiminor(), which is more precise anyways.

BTW: I’ll be on vacation next week, so also from my side it will be silent.

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

  • Status changed from Pull request to Closed

This solved the problem. I now merged your changed in the devel branch.

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

Here a quick validation that I did with ctmodel of an ellipse of 2 x 0.5 deg with a position angle of 45 deg. This look fine. Note that the map is vertically flipped as the Right Ascension increases towards right. Hence in reality, the ellipse runs from top-left to bottom-right, which is ok for a PA of 45 deg counted counterclockwise from North (which is the convention).

The color shape comes from the fact that the ellipse is large with respect to the CTA field of view, hence there is a measurable effective area variation over the shape.

The only problem that occurs is integration convergence (and the related large computing times). I knew that this will happen as the actual integration methods integrate over a circle enclosing the ellipse, hence the model is discontinuous, which leads to convergence problems of the Romberg method. I added action #784 to improve this. But the functionality is now there!

#12 Updated by Knödlseder Jürgen almost 11 years ago

  • Target version changed from HESS sprint #1 to 00-08-00

#13 Updated by Knödlseder Jürgen over 10 years ago

  • Target version deleted (00-08-00)

#14 Updated by Knödlseder Jürgen almost 10 years ago

  • Target version set to 1.0.0

Also available in: Atom PDF