Skip to content

Commit

Permalink
Add dr2-low
Browse files Browse the repository at this point in the history
  • Loading branch information
tikk3r committed Oct 6, 2024
1 parent 2e47e38 commit 1b390b3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 6 additions & 5 deletions src/everystamp/downloaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ class LoTSSDownloader(FileDownloader):
logger = logging.getLogger("EveryStamp:LoTSSDownloader")

def __init__(self):
self.url = "https://lofar-surveys.org/dr2-cutout.fits?pos={coord_str:s}&size={size_arcmin:f}"
self.url = "https://lofar-surveys.org/{release:s}-cutout.fits?pos={coord_str:s}&size={size_arcmin:f}"

def format_url(self, ra: str = "", dec: str = "", size: float = 1.0) -> str:
def format_url(self, ra: str, dec: str, release: str, size: float = 1.0) -> str:
"""
Args:
Expand All @@ -165,19 +165,20 @@ def format_url(self, ra: str = "", dec: str = "", size: float = 1.0) -> str:
.replace("d", ":")
.replace("s", "")
)
url = self.url.format(coord_str=coord_str, size_arcmin=size_arcmin)
url = self.url.format(coord_str=coord_str, size_arcmin=size_arcmin, release=release)
return url

def download(self, **kwargs):
if kwargs["mode"] != "fits":
raise ValueError("LoTSSDownloader only supports FITS downloads.")
furl = self.format_url(ra=kwargs["ra"], dec=kwargs["dec"], size=kwargs["size"])
furl = self.format_url(ra=kwargs["ra"], dec=kwargs["dec"], size=kwargs["size"], release=kwargs["release"])
logger.info(furl)
fname = "LoTSS-DR2_{ra:f}_{dec:f}_{size:.3f}.{mode:s}".format(
fname = "LoTSS-{release:s}_{ra:f}_{dec:f}_{size:.3f}.{mode:s}".format(
ra=kwargs["ra"],
dec=kwargs["dec"],
mode="fits",
size=kwargs["size"],
release=kwargs["release"].upper(),
)
if not kwargs["ddir"]:
self.logger.info(
Expand Down
5 changes: 3 additions & 2 deletions src/everystamp/everystamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def _add_args_download(parser):
type=str,
required=False,
default="dr1",
choices=["pdr", "dr1", "dr2"],
choices=["pdr", "dr1", "dr2", "dr2-low"],
help="Data release to download from.",
)

Expand Down Expand Up @@ -824,7 +824,7 @@ def _process_args_download(args):
name="LoTSS-DR1",
)
vd.download(ra=ra, dec=dec, size=args.size, ddir=args.ddir)
elif args.lotss_release == "dr2":
elif args.lotss_release == "dr2" or args.lotss_release == "dr2-low":
from everystamp.downloaders import LoTSSDownloader

vd = LoTSSDownloader()
Expand All @@ -834,6 +834,7 @@ def _process_args_download(args):
size=args.size,
ddir=args.ddir,
mode=args.mode.replace("e", ""),
release=args.lotss_release
)
elif args.survey == "tgss":
if args.mode == "both" or args.mode == "jpeg":
Expand Down

0 comments on commit 1b390b3

Please sign in to comment.