Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added masking for NGC objects #575

Merged
merged 24 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
497d604
added masking for NGC objects
martinkilbinger Jun 22, 2022
7abd0c3
debugging ngc np binary file
martinkilbinger Jun 24, 2022
4fc3c21
Fixed bugs in new mask handling (input FITS files)
martinkilbinger Jun 28, 2022
f97c937
debug info to log file for checking existing images
martinkilbinger Jun 29, 2022
0f6de15
mask: combined dso masks into dictionary
martinkilbinger Jun 30, 2022
2ea46d4
PR edits
martinkilbinger Jun 30, 2022
812e841
Update shapepipe/modules/mask_package/mask.py
martinkilbinger Sep 12, 2022
98b8c25
Update shapepipe/modules/mask_package/mask.py
martinkilbinger Sep 12, 2022
a24e2dc
Update shapepipe/modules/mask_package/mask.py
martinkilbinger Sep 12, 2022
6283f6a
Update shapepipe/modules/mask_package/mask.py
martinkilbinger Sep 12, 2022
5d97cce
added symlink
martinkilbinger Sep 12, 2022
5d44417
Update shapepipe/pipeline/file_io.py
martinkilbinger Sep 14, 2022
635fbe4
Update shapepipe/modules/mask_package/mask.py
martinkilbinger Sep 14, 2022
6bddb1f
Update shapepipe/pipeline/file_io.py
martinkilbinger Sep 14, 2022
d51f81e
Update shapepipe/pipeline/file_io.py
martinkilbinger Sep 14, 2022
b3949fa
Update shapepipe/pipeline/file_io.py
martinkilbinger Sep 14, 2022
eff9b6c
Update shapepipe/pipeline/file_io.py
martinkilbinger Sep 14, 2022
9d67abd
Merge remote-tracking branch 'upstream/develop' into ngc
martinkilbinger Sep 14, 2022
a27e19c
Update shapepipe/modules/mask_package/mask.py
martinkilbinger Sep 14, 2022
5b24439
Update shapepipe/modules/mask_package/mask.py
martinkilbinger Sep 14, 2022
d0c6f2a
Update shapepipe/modules/mask_package/mask.py
martinkilbinger Sep 14, 2022
baf372f
Update shapepipe/pipeline/file_io.py
martinkilbinger Sep 14, 2022
84f991a
PR suggestions
martinkilbinger Sep 14, 2022
74a8ca1
Fixed html link
martinkilbinger Sep 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions example/cfis/config.mask
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Mask module configuration file
# Mask module configuration file for single-exposure images

## Paths to executables
[PROGRAM_PATH]
Expand Down Expand Up @@ -51,12 +51,23 @@ SPIKE_REG_FILE = spike.reg

MESSIER_MAKE = True

MESSIER_CAT_PATH = $SP_CONFIG/mask_default/Messier_catalog_updated.npy
MESSIER_CAT_PATH = $SP_CONFIG/mask_default/Messier_catalog_updated.fits
MESSIER_SIZE_PLUS = 0.
MESSIER_FLAG_VALUE = 16


# -------------------------- Missing data parameters ------------------------------
## NGC mask
[NGC_PARAMETERS]

NGC_MAKE = True

NGC_CAT_PATH = $SP_CONFIG/mask_default/ngc_cat.fits
NGC_SIZE_PLUS = 0.
NGC_FLAG_VALUE = 32



## Missing data parameters
[MD_PARAMETERS]

MD_MAKE = False
Expand All @@ -66,11 +77,10 @@ MD_THRESH_REMOVE = 0.75
MD_REMOVE = False


# ----------------------------- Other parameters ----------------------------------
## Other parameters
[OTHER]

TEMP_DIRECTORY = .temp

KEEP_REG_FILE = False
KEEP_INDIVIDUAL_MASK = False

7 changes: 6 additions & 1 deletion example/cfis/config_GitFeGie_vos.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN_DATETIME = True
[EXECUTION]

# Module name, single string or comma-separated list of valid module runner names
MODULE = get_images_runner, find_exposures_runner, get_images_runner
MODULE = get_images_runner, find_exposures_runner, get_images_runner

# Parallel processing mode, SMP or MPI
MODE = SMP
Expand Down Expand Up @@ -86,6 +86,9 @@ RETRIEVE = vos
# Copy command options, optional
RETRIEVE_OPTIONS = --certfile=$VM_HOME/.ssl/cadcproxy.pem

CHECK_EXISTING_DIR = output/run_sp_GitFeGie_2022-06-29_09-16-48
N_EXPECTED = 2


[FIND_EXPOSURES_RUNNER]

Expand Down Expand Up @@ -147,3 +150,5 @@ N_TRY = 3
# Retrieve command options, optional
RETRIEVE_OPTIONS = --certfile=$VM_HOME/.ssl/cadcproxy.pem

CHECK_EXISTING_DIR = output/run_sp_GitFeGie_2022-06-29_09-16-48
N_EXPECTED = 15
2 changes: 1 addition & 1 deletion example/cfis/config_MaMa.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ OUTPUT_DIR = $SP_RUN/output
[JOB]

# Batch size of parallel processing (optional), default is 1, i.e. run all jobs in serial
SMP_BATCH_SIZE = 4
SMP_BATCH_SIZE = 8

# Timeout value (optional), default is None, i.e. no timeout limit applied
TIMEOUT = 96:00:00
Expand Down
29 changes: 20 additions & 9 deletions example/cfis/config_tile.mask
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ----------------------------- Path ----------------------------------
# Mask module config file for tiles

## Paths to executables
[PROGRAM_PATH]

WW_PATH = ww
Expand All @@ -8,7 +10,7 @@ WW_CONFIG_FILE = $SP_CONFIG/mask_default/default.ww
# (e.g. no internet access on run nodes)
CDSCLIENT_PATH = findgsc2.2

# ----------------------------- Border parameters ----------------------------------
## Border parameters
[BORDER_PARAMETERS]

BORDER_MAKE = False
Expand All @@ -17,7 +19,7 @@ BORDER_WIDTH = 0
BORDER_FLAG_VALUE = 4


# ----------------------------- Halo parameters ----------------------------------
## Halo parameters
[HALO_PARAMETERS]

HALO_MAKE = True
Expand All @@ -30,7 +32,7 @@ HALO_FLAG_VALUE = 2
HALO_REG_FILE = halo.reg


# ------------------------- Diffraction pike parameters ------------------------------
## Diffraction pike parameters
[SPIKE_PARAMETERS]

SPIKE_MAKE = True
Expand All @@ -43,24 +45,33 @@ SPIKE_FLAG_VALUE = 128
SPIKE_REG_FILE = spike.reg


# ---------------------------- Messier parameters ---------------------------------
## Messier parameters
[MESSIER_PARAMETERS]

MESSIER_MAKE = True

MESSIER_CAT_PATH = $SP_CONFIG/mask_default/Messier_catalog_updated.npy
MESSIER_CAT_PATH = $SP_CONFIG/mask_default/Messier_catalog_updated.fits
MESSIER_PIXEL_SCALE = 0.187
MESSIER_SIZE_PLUS = 0.
MESSIER_FLAG_VALUE = 16

## NGC mask
[NGC_PARAMETERS]

NGC_MAKE = True

NGC_CAT_PATH = $SP_CONFIG/mask_default/ngc_cat.fits
NGC_SIZE_PLUS = 0.
NGC_FLAG_VALUE = 32


# -------------------------------- External flag ----------------------------------
## External flag
[EXTERNAL_FLAG]

EF_MAKE = False


# -------------------------- Missing data parameters ------------------------------
## Missing data parameters
[MD_PARAMETERS]

MD_MAKE = False
Expand All @@ -70,7 +81,7 @@ MD_THRESH_REMOVE = 0.75
MD_REMOVE = False


# ----------------------------- Other parameters ----------------------------------
## Other parameters
[OTHER]

KEEP_REG_FILE = False
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added example/cfis/mask_default/ngc_cat.fits
Binary file not shown.
1 change: 0 additions & 1 deletion scripts/python/cfis_field_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from optparse import OptionParser, IndentedHelpFormatter, OptionGroup

from astropy.io import fits
from astropy.table import Table, Column
from astropy import units
from astropy.coordinates import Angle, SkyCoord

Expand Down
4 changes: 2 additions & 2 deletions shapepipe/modules/get_images_package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
INPUT_NUMBERING : str
Input numbering scheme, python regexp
CHECK_EXISTING_DIR : str, optional
If given, check this directory for existing images, which will then not be
downloaded
If given, search this directory (recursively) for existing images, which
will then not be downloaded
N_EXPECTED : int, optional
If ``CHECK_EXISTING_DIR`` is given, this option specifies the number of
expected images; the default value is ``1``
Expand Down
20 changes: 17 additions & 3 deletions shapepipe/modules/get_images_package/get_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,23 @@ def retrieve(self, all_inputs, all_outputs):
f'{self._check_existing_dir}/**/{out_base}',
recursive=True,
)
if path and len(path) == self._n_expected:
self._w_log.info(f'{path[0]} found, skipping')
continue
if path:
if len(path) == self._n_expected:
self._w_log.info(
f'{path[0]} found, skipping download'
)
continue
else:
self._w_log.info(
f'{len(path)} instead of {self._n_expected} '
+ f'files found at {self._check_existing_dir}'
+ ', downloading images'
)
else:
self._w_log.info(
f'No images found at {self._check_existing_dir},'
+ ' downloading images'
)
self.retrieve_one(in_per_type[idx], out_per_type[idx])

def retrieve_one(self, in_path, out_path):
Expand Down
29 changes: 22 additions & 7 deletions shapepipe/modules/mask_package/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
Description
===========

This module creates masks for bright stars, diffraction spikes, Messier
objects, borders, and other artifacts. If a flag file is given as input,
for example from pre-processing, the mask that is created by this module
is joined with the mask from this external flag file. In this case
the config flag ``USE_EXT_FLAG`` needs to be set to ``True``. To distinguish
the newly created output flag file from the input ones, a prefix can added as
specificed by the config entry ``PREFIX``.
This module creates masks for bright stars, diffraction spikes, deep sky
objects (from the Messier and NGC catalogues), borders, and other artifacts. If
a flag file is given as input, for example from pre-processing, the mask that
is created by this module is joined with the mask from this external flag file.
In this case the config flag ``USE_EXT_FLAG`` needs to be set to ``True``. To
distinguish the newly created output flag file from the input ones, a prefix
can added as specificed by the config entry ``PREFIX``.

An NGC catalogue with positions, sizes, and types is provided with `shapepipe`,
sfarrens marked this conversation as resolved.
Show resolved Hide resolved
source: www.klima-luft.de/steinicke/ngcic/rev2000/Explan.htm

Masked pixels of different mask types are indicated by integers, which
conveniently are powers of two such that they can be combined bit-wise.
Expand Down Expand Up @@ -137,6 +140,18 @@
MESSIER_FLAG_VALUE : int
Messier mask pixel value, power of 2

[NGC_PARAMETERS]
--------------------

NGC_MAKE : bool
Create mask around NGC objects if ``True``
NGC_CAT_PATH : str
Path to NGC catalogue
NGC_SIZE_PLUS : float
Fraction to increase NGC mask
NGC_FLAG_VALUE : int
NGC mask pixel value, power of 2

[MD_PARAMETERS]
---------------

Expand Down
Loading