Skip to content

Commit

Permalink
deprecated StarCenteringModule
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Stolker committed Jun 25, 2019
1 parent 83bf8b6 commit 7e46286
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 630 deletions.
180 changes: 94 additions & 86 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ First we need to import the Pypeline, as well as the I/O and processing modules.

Next, we create an instance of :class:`~pynpoint.core.pypeline.Pypeline` with the ``working_place_in`` pointing to a path where PynPoint has enough space to create its database, ``input_place_in`` pointing to the path with the raw FITS files, and ``output_place_in`` to a folder for the output::

pipeline = Pypeline(working_place_in="/path/to/working_place",
input_place_in="/path/to/input_place",
output_place_in"/path/to/output_place")
pipeline = Pypeline(working_place_in='/path/to/working_place',
input_place_in='/path/to/input_place',
output_place_in'/path/to/output_place')

The FWHM of the PSF is defined for simplicity::

Expand All @@ -31,96 +31,96 @@ Now we are ready to add all the pipeline modules that we need. Have a look at th

1. Import the raw science, flat, and dark images into the database::

module = FitsReadingModule(name_in="read1",
input_dir="/path/to/science/",
image_tag="science",
module = FitsReadingModule(name_in='read1',
input_dir='/path/to/science/',
image_tag='science',
overwrite=True,
check=True)

pipeline.add_module(module)

module = FitsReadingModule(name_in="read2",
input_dir="/path/to/flat/",
image_tag="flat",
module = FitsReadingModule(name_in='read2',
input_dir='/path/to/flat/',
image_tag='flat',
overwrite=True,
check=False)

pipeline.add_module(module)

module = FitsReadingModule(name_in="read4",
input_dir="/path/to/dark/",
image_tag="dark",
module = FitsReadingModule(name_in='read4',
input_dir='/path/to/dark/',
image_tag='dark',
overwrite=True,
check=False)

pipeline.add_module(module)

2. Import the image with the (separately processed) unsaturated PSF of the star::

module = Hdf5ReadingModule(name_in="read4",
input_filename="flux.hdf5",
input_dir="/path/to/flux/",
tag_dictionary={"flux": "flux"})
module = Hdf5ReadingModule(name_in='read4',
input_filename='flux.hdf5',
input_dir='/path/to/flux/',
tag_dictionary={'flux': 'flux'})

pipeline.add_module(module)

3. Remove NDIT+1 frames which contain the average of the FITS cube (NACO specific)::

module = RemoveLastFrameModule(name_in="last",
image_in_tag="science",
image_out_tag="last")
module = RemoveLastFrameModule(name_in='last',
image_in_tag='science',
image_out_tag='last')

pipeline.add_module(module)

4. Calculate the parallactic angles which each image::

module = AngleCalculationModule(name_in="angle",
data_tag="last",
instrument="NACO")
module = AngleCalculationModule(name_in='angle',
data_tag='last',
instrument='NACO')

pipeline.add_module(module)

5. Remove the top and bottom line to make the images square::

module = RemoveLinesModule(lines=(0, 0, 1, 1),
name_in="cut",
image_in_tag="last",
image_out_tag="cut")
name_in='cut',
image_in_tag='last',
image_out_tag='cut')

pipeline.add_module(module)

6. Subtract the dark current from the flat field::

module = DarkCalibrationModule(name_in="dark",
image_in_tag="flat",
dark_in_tag="dark",
image_out_tag="flat_cal")
module = DarkCalibrationModule(name_in='dark',
image_in_tag='flat',
dark_in_tag='dark',
image_out_tag='flat_cal')

pipeline.add_module(module)

7. Divide the science data by the master flat::

module = FlatCalibrationModule(name_in="flat",
image_in_tag="science",
flat_in_tag="flat_cal",
image_out_tag="science_cal")
module = FlatCalibrationModule(name_in='flat',
image_in_tag='science',
flat_in_tag='flat_cal',
image_out_tag='science_cal')

pipeline.add_module(module)

8. Remove the first 5 frames from each FITS cube because of the systematically higher background emission::

module = RemoveStartFramesModule(frames=5,
name_in="first",
image_in_tag="science_cal",
image_out_tag="first")
name_in='first',
image_in_tag='science_cal',
image_out_tag='first')

pipeline.add_module(module)

9. PCA based background subtraction::

module = DitheringBackgroundModule(name_in="background",
image_in_tag="first",
image_out_tag="background",
module = DitheringBackgroundModule(name_in='background',
image_in_tag='first',
image_out_tag='background',
center=((263, 263), (116, 263), (116, 116), (263, 116)),
cubes=None,
size=3.5,
Expand All @@ -134,16 +134,16 @@ Now we are ready to add all the pipeline modules that we need. Have a look at th
crop=True,
prepare=True,
pca_background=True,
combine="pca")
combine='pca')

pipeline.add_module(module)

10. Bad pixel correction::

module = BadPixelSigmaFilterModule(name_in="bad",
image_in_tag="background",
image_out_tag="bad",
map_out_tag="bpmap",
module = BadPixelSigmaFilterModule(name_in='bad',
image_in_tag='background',
image_out_tag='bad',
map_out_tag='bpmap',
box=9,
sigma=5.,
iterate=3)
Expand All @@ -152,25 +152,25 @@ Now we are ready to add all the pipeline modules that we need. Have a look at th

11. Frame selection::

module = FrameSelectionModule(name_in="select",
image_in_tag="bad",
selected_out_tag="selected",
removed_out_tag="removed",
module = FrameSelectionModule(name_in='select',
image_in_tag='bad',
selected_out_tag='selected',
removed_out_tag='removed',
index_out_tag=None,
method="median",
method='median',
threshold=2.,
fwhm=fwhm,
aperture=("circular", fwhm),
aperture=('circular', fwhm),
position=(None, None, 4.*fwhm))

pipeline.add_module(module)

12. Extract the star position and center with pixel precision::

module = StarExtractionModule(name_in="extract",
image_in_tag="selected",
image_out_tag="extract",
index_out_tag="index",
module = StarExtractionModule(name_in='extract',
image_in_tag='selected',
image_out_tag='extract',
index_out_tag='index',
image_size=3.,
fwhm_star=fwhm,
position=(None, None, 4.*fwhm))
Expand All @@ -179,11 +179,11 @@ Now we are ready to add all the pipeline modules that we need. Have a look at th

13. Align the images with a cross-correlation of the central 800 mas::

module = StarAlignmentModule(name_in="align",
image_in_tag="odd",
module = StarAlignmentModule(name_in='align',
image_in_tag='odd',
ref_image_in_tag=None,
image_out_tag="align",
interpolation="spline",
image_out_tag='align',
interpolation='spline',
accuracy=10,
resize=None,
num_references=10,
Expand All @@ -193,34 +193,42 @@ Now we are ready to add all the pipeline modules that we need. Have a look at th

14. Center the images with subpixel precision by applying a constant shift::

module = StarCenteringModule(name_in="center",
image_in_tag="align",
image_out_tag="center",
mask_out_tag=None,
fit_out_tag="fit",
method="mean",
interpolation="spline",
radius=5.*fwhm,
sign="positive",
guess=(0., 0., 1., 1., 100., 0., 0.))
module = FitCenterModule(name_in='center',
image_in_tag='align',
fit_out_tag='fit',
mask_out_tag=None,
method='mean',
radius=5.*fwhm,
sign='positive',
model='gaussian',
filter_size=None,
guess=(0., 0., 1., 1., 100., 0., 0.))

pipeline.add_module(module)

module = ShiftImagesModule(name_in='shift',
image_in_tag='align',
image_out_tag='center',
shift_xy='fit',
interpolation='spline')

pipeline.add_module(module)

15. Stack by 100 images::

module = StackAndSubsetModule(name_in="stack",
image_in_tag="center",
image_out_tag="stack",
module = StackAndSubsetModule(name_in='stack',
image_in_tag='center',
image_out_tag='stack',
random=None,
stacking=100)

pipeline.add_module(stack)

16. Prepare the data for PSF subtraction::

module = PSFpreparationModule(name_in="prep",
image_in_tag="stack",
image_out_tag="prep",
module = PSFpreparationModule(name_in='prep',
image_in_tag='stack',
image_out_tag='prep',
mask_out_tag=None,
norm=False,
resize=None,
Expand All @@ -232,11 +240,11 @@ Now we are ready to add all the pipeline modules that we need. Have a look at th
17. PSF subtraction with PCA::

module = PcaPsfSubtractionModule(pca_numbers=range(1, 51),
name_in="pca",
images_in_tag="prep",
reference_in_tag="prep",
res_mean_tag="pca_mean",
res_median_tag="pca_median",
name_in='pca',
images_in_tag='prep',
reference_in_tag='prep',
res_mean_tag='pca_mean',
res_median_tag='pca_median',
res_weighted_tag=None,
res_arr_out_tag=None,
res_rot_mean_clip_tag=None,
Expand All @@ -249,18 +257,18 @@ Now we are ready to add all the pipeline modules that we need. Have a look at th
module = FalsePositiveModule(position=(50.5, 26.5),
aperture=fwhm/2.,
ignore=True,
name_in="fpf",
image_in_tag="pca_median",
snr_out_tag="fpf")
name_in='fpf',
image_in_tag='pca_median',
snr_out_tag='fpf')

pipeline.add_module(module)

19. Write the median residuals to a FITS file::

module = FitsWritingModule(name_in="write",
file_name="residuals.fits",
module = FitsWritingModule(name_in='write',
file_name='residuals.fits',
output_dir=None,
data_tag="pca_median",
data_tag='pca_median',
data_range=None)

pipeline.add_module(module)
Expand All @@ -271,4 +279,4 @@ Now we are ready to add all the pipeline modules that we need. Have a look at th

21. Or, to run a specific pipeline module individually::

pipeline.run_module("pca")
pipeline.run_module('pca')
1 change: 0 additions & 1 deletion pynpoint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
RepeatImagesModule

from pynpoint.processing.centering import StarAlignmentModule, \
StarCenteringModule, \
FitCenterModule, \
ShiftImagesModule, \
WaffleCenteringModule
Expand Down

0 comments on commit 7e46286

Please sign in to comment.