HOW-TO Create a RegriddedFrame

Making RegriddedFrames using the DPU

For the RegridTask, the DPU command would look something like:

awe> dpu.run('Regrid', d='2001-01-22', i='WFI', f='#841', o='AXAF')

The RegridTask options via the DPU are as follows:

  • i (instrument, mandatory): string
  • d (date): string of the form CCYY-MM-DD
  • f (filter): string
  • o (object): string, possibly using wildcards * and/or ?
  • raw (raw_filenames): list, a list of filenames of raw science frames that have reduced science frames
  • red (red_filenames): list, a list of filenames of reduced science frames
  • gra (grid_ra): float, right ascension of grid target
  • gdec (grid_dec): float, declination of grid target
  • gps (grid_pixelscale): float, requested pixelscale
  • C (commit): integer=0..1 (optional, default=0)

This example shows how to run the DPU RegridTask using date, filter, and object information. This allows one to process all data for a given object on a specific day taken in a certain filter, for all CCDs of the mosaic.

The options can be used in any order and can be omitted (except i), but the likelihood of locating required data depends on relaying a minimum of information as shown in the examples.

The GridTarget is the RegriddedFrame(s) its regrid center. The RA and DEC of the GridTarget are determined by a system that divides the sky in a set of pre-determined plates. Note: for large fields of view like OMEGACAM, the determined grid target ra and dec can be those of different place. This will cause errors in a later step called CoaddTask. However, it is possible for the user to force all regridded frames to the same grid target. For the DPU the following two steps should be taken:

  1. Determine grid target of one frame For instance do:

    awe> dpu.run(red_filenames=[<filename>])
    

    The logs of this task step show the grid target ra and dec of the frame.

  2. Apply the grid target of step one to all other frames The logs of the first step show the grid target ra and dec, these should now be included as arguments, like:

    awe> dpu.run(red_filenames=[<all filenames>], gra=<grid target ra as determined from step 1>, gdec=<grid target dec as determined from step 1>)
    

Making a RegriddedFrame using the RegridTask

Although the ideal method to create RegriddedFrames is the DPU, this task can be performed in on a per chip basis. The RegridTask is the main part of the recipe $AWEPIPE/astro/recipes/Regrid.py. An example of the syntax for the RegridTask is given below:

awe> reg = RegridTask(date='2001-01-22', chip='ccd51', filter='#841',
...                   object='AXAF')
awe> reg.execute()

The RegridTask options are as follows:

  • date: string of the form CCYY-MM-DD
  • chip: string
  • filter: string
  • object: string, possibly using wildcards * and/or ?
  • raw (raw_filenames): list, a list of raw science frames that have reduced science frames
  • red (red_filenames): list, a list of reduced science frames
  • gra (grid_ra): float, right ascension of grid target
  • gdec (grid_dec): float, declination of grid target
  • gps (grid_pixelscale): float, requested pixelscale
  • fsg (force_single_gridtarget): force the grid target to be similar for all input frames
  • commit: integer=0..1 (optional, default=0)

This example shows how to run the RegridTask using date, chip, filter, and object information. This allows one to process all ReducedScienceFrames for a given object on a specific day taken in a certain filter, and with only one CCD of the mosaic.

The options can be used in any order and can be omitted, but the likelihood of locating required data depends on relaying a minimum of information as shown in the examples.

The GridTarget is the RegriddedFrame(s) its regrid center. The RA and DEC of the GridTarget are determined by a system that divides the sky in a set of pre-determined plates. Note: for large fields of view like OMEGACAM, the determined grid target ra and dec can be those of different place. This will cause errors in a later step called CoaddTask. However, it is possible for the user to force all regridded frames to the same grid target. The argument force_single_gridtarget has to be included, like for instance:

awe> reg = RegridTask(red_filenames=[<filenames>], fsg=True)

Making a RegriddedFrame using the basic building blocks

The third, and most powerful, way of creating a RegriddedFrame is by using the basic building blocks of the system directly from the awe-prompt. This method is used if one wants to manipulate the system down to the nitty-gritty details. An example of how a RegriddedFrame is made from the awe-prompt in this fashion is given below:

 1. awe> from astro.main.RegriddedFrame import RegriddedFrame
 2  awe> from astro.main.RegriddedFrame import GridTarget
 3. awe> from astro.main.ReducedScienceFrame import ReducedScienceFrame
 4. awe> from astro.main.AstrometricParameters import AstrometricParameters
 5. awe> from astro.main.PhotometricParameters import PhotometricParameters
 6. awe> from astro.main.GainLinearity import GainLinearity

 7. awe> reduced       = (ReducedScienceFrame.filename == 'Sci-GVERDOES-WFI---
    ...  ----#842-ccd55-Red---Sci-53811.3816955.fits')[0]
 8. awe> astrom_query  = (AstrometricParameters.reduced == reduced) &\
    ...                  (AstrometricParameters.quality_flags == 0) &\
    ...                  (AstrometricParameters.is_valid == 1)
 9. awe> astrom_params = astrom_query.max('creation_date')
10. awe> photom_params = PhotometricParameters.select_for_raw(reduced.raw)
11. awe> gain          = GainLinearity.select_for_raw(reduced.raw)

12. awe> from astro.util.PlateSystem import PlateSystem
13. awe> platesystem = PlateSystem()
14. awe> ra, dec = platesystem.get_field_centre(reduced.astrom.CRVAL1,
    ...                                         reduced.astrom.CRVAL2)
15. awe> grid_target = GridTarget()
16. awe> grid_target.RA = ra
17. awe> grid_target.DEC = dec
18. awe> grid_target.pixelscale = 0.20

19. awe> regrid = RegriddedFrame()
20. awe> regrid.process_params.MAXIMUM_PSF_DIFFERENCE = 0.30
21. awe> regrid.swarpconf.SUBTRACT_BACK = 'Y'
22. awe> regrid.swarpconf.BACK_SIZE = 256

23. awe> regrid.reduced       = reduced
24. awe> regrid.grid_target   = grid_target
25. awe> regrid.astrom_params = astrom_params
26. awe> regrid.photom_params = photom_params
27. awe> regrid.gain          = gain
28. awe> regrid.reduced.retrieve()
29. awe> regrid.reduced.weight.retrieve()
30. awe> regrid.set_filename()

31. awe> regrid.make()
32. awe> regrid.store()
33. awe> regrid.weight.store()
34. awe> regrid.commit()

In steps (1)-(6), the classes relevant for this processing step are imported. In steps (7)-(11), the database is queried for the necessary dependencies. In step (7), the ReducedScienceFrame to be regridded is retrieved, and in steps (8)-(11) the calibration data to use. The steps (12)-(18) are unique for making a RegriddedFrame; the GridTarget is a non-ProcessTarget object that provides the RegriddedFrame its regrid center. The RA and DEC of the GridTarget are determined by a system that divides the sky in a set of pre-determined plates (hence the steps (12)-(14)). In steps (19)-(22), the RegriddedFrame object is instantiated, and a few of its process configuration parameters are set. In steps (23)-(30), the dependencies of the RegriddedFrame are set, and the pixel-data of the input ReducedScienceFrame and its associated weight are retrieved from the fileserver. In step (30), the filename of the RegriddedFrame to be is created and set. Finally, in steps (31)-(34), the RegriddedFrame is made, its pixel-data is stored, and the object itself is committed to the database. Note that in step (33), the WeightFrame associated with the RegriddedFrame object is also stored; the weights are a very important by-product of making the RegriddedFrame that should never be forgotten.