Feature #2725

Add setter for exclusion regions

Added by Specovius Andreas over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:11/08/2018
Priority:NormalDue date:
Assigned To:Specovius Andreas% Done:

100%

Category:-Estimated time:15.00 hours
Target version:1.6.0
Duration:

Description

There are ctools and cscripts that allow the use of exclusion regions.
Currently the only way to involve them is to provide the path to region files on disk.
It would be good to allow the user to set these regions directly from within python scripts.

Scripts that allow the user to provide exclusion regions are:
  • ctskymap
  • csphagen
  • cslightcrv
  • csphasecrv

Recurrence

No recurrence.

History

#1 Updated by Specovius Andreas over 5 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 20

For ctskymap I added setter and getter for the exclusion map object. In setup_maps() it is now testet if the exclusion map is empty or has already been filled. If the map has already been filled it is adjusted for the fov to fit the fov of the counts map. As this functionality equals the one used in setup_exclusion_map_fits() it is moved to the new function adjust_exclusion_map() to avoid redundance.

#2 Updated by Specovius Andreas over 5 years ago

Csphagen internally stores the exclusion map as a GSkyRegionMap object - not as a GSkyMap object like ctskymap does.

For csphagen I added a combined setter and getter for the exclusion map object. Inside, the internal parameter that stores the exclusion map is initialised to be a GSkyRegionMap. As a GSkyRegionMap can be initialised from a GSkyRegion subclass and a GSkyMap object, obviously principally both can also be provided to the setter.

#3 Updated by Specovius Andreas over 5 years ago

  • % Done changed from 20 to 40

#4 Updated by Specovius Andreas over 5 years ago

For cslightcrv and csphasecrv things are a little more complicated as the cscripts themselve do not handle the exclusion region. It is indeed handled by the obsutils module, which is called from inside the cscripts. In these cscripts the exclusion regions are generally only used for on/off analyses.

To cslightcrv I added a class parameter _excl_reg_map initialised to None but fillable via a newly implemented combined setter and getter function, similar to csphagen.

I also modified the obsutils module to pipe the exclusion region to csphagen if _excl_reg_map is present and has been set.

#5 Updated by Specovius Andreas over 5 years ago

  • % Done changed from 40 to 70

#6 Updated by Specovius Andreas over 5 years ago

  • % Done changed from 70 to 90

To csphasecrv I added a class parameter _excl_reg_map initialised to None but fillable via a newly implemented combined setter and getter function, equally to cslightcrv.

#7 Updated by Specovius Andreas over 5 years ago

  • Status changed from In Progress to Feedback
  • % Done changed from 90 to 100

All tools that feature an inexclusion parameter have now been modified and I think the code is ready for review.

#8 Updated by Specovius Andreas over 5 years ago

Note that there is now another issue dealing with the exclusion regions: #2730 (adapt tools to use GSkyRegions containers instead of maps directly).

#9 Updated by Knödlseder Jürgen over 5 years ago

  • Status changed from Feedback to Pull request
  • Target version set to 1.6.0

I changed the name of the methods to exclusion_map, and all method now set or return an instance of GSkyRegionMap, i.e. also for ctskymap. This is already one step towards the provision of a more homogenous interface.

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

  • Status changed from Pull request to Closed

Merged into devel.

#11 Updated by Specovius Andreas over 5 years ago

The implementation of csphagen.exclusion_map(self) overwrites the implementation of csphagen.exclusion_map(self, object).
This is C-style but unfortunately not possible for Python.
To work around that I implemented the combined getter and setter.

Also available in: Atom PDF