Skip to content

Commit

Permalink
Update notes
Browse files Browse the repository at this point in the history
  • Loading branch information
rhandberg committed Feb 10, 2022
1 parent 3757322 commit e3e464f
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions notes/update_all_catalogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import sys
import os.path
from tqdm import tqdm
import tqdm
from astropy.coordinates import SkyCoord
if os.path.abspath('..') not in sys.path:
sys.path.insert(0, os.path.abspath('..'))
Expand Down Expand Up @@ -37,12 +37,16 @@ def emit(self, record):
logger.addHandler(console)
logger.setLevel(logging.INFO)

for target in tqdm(flows.api.get_targets()):
#if target['targetid'] != 1942:
# continue

donefile = f"{target['targetid']:05d}.done"
if not os.path.exists(donefile):
flows.catalogs.download_catalog(target['targetid'], update_existing=True)

open(donefile, 'w').close()
# Do it by status, just to prioritize things a bit:
for tgtstatus in ('target', 'candidate', 'rejected'):
targetids = sorted([tgt['targetid'] for tgt in flows.api.get_targets() if tgt['target_status'] == tgtstatus])[::-1]

for targetid in tqdm.tqdm(targetids, desc=tgtstatus):
donefile = f"catalog_updates/{targetid:05d}.done"
if not os.path.exists(donefile):
try:
flows.catalogs.download_catalog(targetid, update_existing=True)
except:
logger.exception("targetid=%d", targetid)
else:
open(donefile, 'w').close()

0 comments on commit e3e464f

Please sign in to comment.