Feature #1217

Allow setting Emin and Emax in ctlike

Added by Lu Chia-Chun almost 10 years ago. Updated almost 10 years ago.

Status:ClosedStart date:06/16/2014
Priority:HighDue date:
Assigned To:Lu Chia-Chun% Done:

100%

Category:-
Target version:3rd coding sprint
Duration:

Description

Now ctlike takes the energy range defined in the ctselect or ctbin output files (event lists or cubes) to perform the fitting. For testing or convenience reasons, there should be a possibility to set a user-defined energy range for the fitting.


Recurrence

No recurrence.

History

#1 Updated by Lu Chia-Chun almost 10 years ago

  • Status changed from New to In Progress
  • Assigned To changed from Knödlseder Jürgen to Lu Chia-Chun
  • % Done changed from 0 to 80

A ctool, ctfilter, is implemented for this task. ctfilter allows setting Emin, Emax, and roi for a eventcube. The pixels out of the energy of interest and region of interest are set -1. They will be ignored in ctlike.

The new filtered eventcube replaces the old eventcube in the GCTAObservation and a new eventcube fits file is created.

Todos:
Allow multiple roi and exclusion regions.
Tidy up codes.
Give messages of excluded cube slices in GCTAEventCube::print(const GChatter& chatter)

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

I implemented the event bin filtering in GammaLib (not yet tested). So when you now set energy bins to negative values they will be excluded from the fit.

You may test this feature by comparing two event cubes, one with an additional energy layer where all bins are set to -1, and one without that layer. The fit results should then be identical.

#3 Updated by Lu Chia-Chun almost 10 years ago

  • Status changed from In Progress to Pull request
  • Target version set to 3rd coding sprint
  • % Done changed from 80 to 90

Link
https://github.com/chiachun/ctools/tree/1217.4-ctcubemask

- Not sure what log messages should be there.
- Tried to make it fit gammalib convention. Hope it’s not too bad....
- GSkyRegions now only accept on exclusion region in the file. More regions result in
  • ERROR encounterted in the execution of ctcubemask. Run aborted ...
  • ERROR in GSkyRegions::append(GSkyRegion&): Invalid value.
    Attempt to append region with name “” to region container, but a region with the same name exists already at index 0 in the container.
    Every region in the region container needs a unique name.

It’s a problem of GSkyRegions(). Will make an issue for it.

- It seems that @param[in] is missing for this constructor, but I see the same thing missing in ctbin so I didn’t add it in.

/***********************************************************************//** * @brief Observations constructor * * This constructor creates an instance of the class that is initialised from * an observation container.
*******************************************************************/
ctcubemask::ctcubemask(GObservations obs) : GApplication(CTCUBEMASK_NAME,
CTCUBEMASK_VERSION)

#4 Updated by Lu Chia-Chun almost 10 years ago

Found out why GSkyRegions(ds9.reg) doesn’t work for multiple regions, because I didn’t put {text=name}.

#5 Updated by Lu Chia-Chun almost 10 years ago

Please check this link, after update on gammalib-devel.

https://github.com/chiachun/ctools/tree/1217.5-ctcubemask-merge-devel

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

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

Merged into devel.

I went over the code and did some clean up (there was old stuff from ctselect in there that handles temporary file, you don’t need that).

I also adjusted slightly the energy selection, as I did not manage to select the full dataset using for emin and emax the values of the actual counts cube. Now it works. I added a 1e-6 margin internally, as when energy are read back from FITS they may differ by tiny amount from the original value.

I made exclusion regions optional, i.e. when you write “NONE” nothing is excluded (and no file is needed).

I also added a unit test to the test script. Seems all to be okay.

#7 Updated by Lu Chia-Chun almost 10 years ago

Oh! NO!! https://github.com/chiachun/ctools/tree/1217.4-ctcubemask
is the right version.....1217.5-ctcubemask is wrong!!

It looks like all changes I made in 1217.4 were erased when I updated to 1217.5.

I did clean up the temp file stuff and add “NO” option to exclusion regions and put everything in ctool convension. Sad.T_T

But anyway, thank you for the work.

#8 Updated by Lu Chia-Chun almost 10 years ago

Some doxygen documentations are missing in this version. I will add them back later.

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

  • Status changed from Resolved to Closed

Also available in: Atom PDF