Skip to content

Commit

Permalink
merged ContourCutout with Cutout class
Browse files Browse the repository at this point in the history
  • Loading branch information
joshoewahp committed Feb 12, 2024
1 parent 2cead75 commit c310b0c
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 514 deletions.
37 changes: 19 additions & 18 deletions cutout/cli/cutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from astroutils.io import FITSException, get_surveys
from astroutils.logger import setupLogger

from cutout import ContourCutout, CornerMarker, Cutout
from cutout import CornerMarker, Cutout

SURVEYS = get_surveys()
SURVEYS.set_index("survey", inplace=True)
Expand Down Expand Up @@ -48,16 +48,11 @@
help="Survey data to use for contours.",
)
@click.option(
"-l",
"--clabels",
"-Q",
"--query-simbad",
is_flag=True,
help="Display contour level labels.",
default=False,
)
@click.option(
"--pm/--no-pm",
default=False,
help="Trigger proper motion correction for nearby stars.",
help="Query SIMBAD and apply proper motion corrections.",
)
@click.option(
"-e",
Expand Down Expand Up @@ -193,8 +188,7 @@
def main(
size,
contours,
clabels,
pm,
query_simbad,
epoch,
fieldname,
sbid,
Expand Down Expand Up @@ -281,9 +275,7 @@ def main(
size *= u.deg

try:
CutoutClass = Cutout if not contours else ContourCutout

cutout = CutoutClass(
cutout = Cutout(
survey,
position,
size=size,
Expand All @@ -296,18 +288,24 @@ def main(
cmap=cmap,
selavy=selavy,
neighbours=neighbours,
contours=contours,
band=band,
vmin=vmin,
vmax=vmax,
maxnorm=maxnorm,
compact=True,
)

cutout.plot(clabels=clabels)
cutout.plot()

if pm:
cutout.correct_proper_motion()
if query_simbad:
simbad, newpos = cutout.query_simbad()
logger.info(f"SIMBAD results:\n {simbad.head()}")
cutout.add_markers(
newpos,
color="dodgerblue",
marker="x",
s=100,
)

if corner:
span = len(cutout.data) / 4
Expand All @@ -321,6 +319,9 @@ def main(
)
cutout.add_cornermarker(corner)

if contours:
cutout.add_contours(contours, position)

if psf:
cutout.add_psf()

Expand Down
Loading

0 comments on commit c310b0c

Please sign in to comment.