Skip to content

Commit

Permalink
Minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rhandberg committed Apr 13, 2021
1 parent ac8ce29 commit 6d56aec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
21 changes: 11 additions & 10 deletions photometry/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import contextlib
from tqdm import tqdm
from .tasoc_db import TASOC_DB
from .utilities import (add_proper_motion, load_sector_settings, # find_catalog_files
from .utilities import (add_proper_motion, load_sector_settings,
radec_to_cartesian, cartesian_to_radec, download_file, to_tuple)

#--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -112,15 +112,15 @@ def make_catalog(sector, input_folder=None, cameras=None, ccds=None, coord_buffe
Parameters:
sector (int): TESS observing sector.
input_folder (str or None, optional): Input folder to create catalog file in.
input_folder (str or None): Input folder to create catalog file in.
If ``None``, the input directory in the environment variable ``TESSPHOT_INPUT`` is used.
cameras (iterable or None, optional): TESS cameras (1-4) to create catalogs for.
cameras (iterable or None): TESS cameras (1-4) to create catalogs for.
If ``None`` all cameras are created.
ccds (iterable or None, optional): TESS ccds (1-4) to create catalogs for.
ccds (iterable or None): TESS ccds (1-4) to create catalogs for.
If ``None`` all ccds are created.
coord_buffer (float, optional): Buffer in degrees around each CCD to include in catalogs.
Default=0.1.
overwrite (bool, optional): Overwrite existing catalogs. Default=``False``.
coord_buffer (float): Buffer in degrees around each CCD to include in catalogs.
Default=0.2.
overwrite (bool): Overwrite existing catalogs. Default=``False``.
Note:
This function requires the user to be connected to the TASOC network
Expand All @@ -129,12 +129,13 @@ def make_catalog(sector, input_folder=None, cameras=None, ccds=None, coord_buffe
table.
Raises:
OSError: If settings could not be loaded from TASOC databases.
RuntimeError: If settings could not be correctly loaded from TASOC databases.
.. codeauthor:: Rasmus Handberg <[email protected]>
"""

logger = logging.getLogger(__name__)
if coord_buffer < 0:
raise ValueError("Invalid COORD_BUFFER")

# Make sure cameras and ccds are iterable:
cameras = to_tuple(cameras, (1,2,3,4))
Expand Down Expand Up @@ -207,7 +208,7 @@ def make_catalog(sector, input_folder=None, cameras=None, ccds=None, coord_buffe
))
row = tasocdb.cursor.fetchone()
if row is None:
raise OSError(f"The given SECTOR={sector:d}, CAMERA={camera:d}, CCD={ccd:d} combination was not found in TASOC database.")
raise RuntimeError(f"The given SECTOR={sector:d}, CAMERA={camera:d}, CCD={ccd:d} combination was not found in TASOC database.")
footprint = row[0]
camera_centre_ra = row[1]
camera_centre_dec = row[2]
Expand Down
10 changes: 7 additions & 3 deletions run_make_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ def main():
parser.add_argument('-d', '--debug', help='Print debug messages.', action='store_true')
parser.add_argument('-q', '--quiet', help='Only report warnings and errors.', action='store_true')
parser.add_argument('-o', '--overwrite', help='Overwrite existing files.', action='store_true')
parser.add_argument('--camera', type=int, choices=(1,2,3,4), default=None, help='TESS Camera. Default is to run all cameras.')
parser.add_argument('--ccd', type=int, choices=(1,2,3,4), default=None, help='TESS CCD. Default is to run all CCDs.')
group = parser.add_argument_group('Filter which CCDs to include')
group.add_argument('--camera', type=int, choices=(1,2,3,4), default=None, action='append', help='TESS Camera. Default is to run all cameras.')
group.add_argument('--ccd', type=int, choices=(1,2,3,4), default=None, action='append', help='TESS CCD. Default is to run all CCDs.')
group = parser.add_argument_group('Settings')
group.add_argument('--buffer', type=float, default=0.2, help="Buffer in degrees around each CCD to include in catalogs.")
parser.add_argument('sector', type=int, help='TESS observing sector to generate catalogs for.')
parser.add_argument('input_folder', type=str, help='Directory to create catalog files in.', nargs='?', default=None)
args = parser.parse_args()
Expand All @@ -58,7 +61,8 @@ def main():
input_folder=args.input_folder,
cameras=args.camera,
ccds=args.ccd,
overwrite=args.overwrite)
overwrite=args.overwrite,
coord_buffer=args.buffer)

#--------------------------------------------------------------------------------------------------
if __name__ == '__main__':
Expand Down

0 comments on commit 6d56aec

Please sign in to comment.