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

Dont cache references #1008

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
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
30 changes: 1 addition & 29 deletions mirar/pipelines/winter/generator/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"""

import logging
import os

from mirar.data import Image, ImageBatch
from mirar.database.constraints import DBQueryConstraints
from mirar.database.transactions import select_from_table
from mirar.paths import REF_CAT_PATH_KEY, get_output_dir
from mirar.pipelines.winter.config import (
ref_psfex_path,
Expand All @@ -18,16 +15,10 @@
)
from mirar.pipelines.winter.constants import winter_filters_map
from mirar.pipelines.winter.generator.utils import winter_ref_catalog_namer
from mirar.pipelines.winter.models import (
DEFAULT_FIELD,
RefComponent,
RefQuery,
RefStack,
)
from mirar.pipelines.winter.models import RefComponent, RefQuery, RefStack
from mirar.processors.astromatic import PSFex, Sextractor, Swarp
from mirar.processors.split import SUB_ID_KEY
from mirar.references import PS1Ref
from mirar.references.local import RefFromPath
from mirar.references.wfcam.wfcam_query import WFAUQuery
from mirar.references.wfcam.wfcam_stack import WFCAMStackedRef

Expand Down Expand Up @@ -188,25 +179,6 @@ def winter_reference_generator(image: Image):

cache_ref_stack = False
if filtername in ["J", "H"]:
if fieldid != DEFAULT_FIELD:
cache_ref_stack = True
constraints = DBQueryConstraints(
columns=["fieldid", SUB_ID_KEY.lower()],
accepted_values=[fieldid, subdetid],
)

db_results = select_from_table(
db_constraints=constraints,
sql_table=RefStack.sql_model,
output_columns=["savepath"],
)

if len(db_results) > 0:
savepath = db_results["savepath"].iloc[0]
if os.path.exists(savepath):
logger.debug(f"Found reference image in database: {savepath}")
return RefFromPath(path=savepath, filter_name=filtername)

skip_online_query = filtername == "H"

wfcam_query = WFAUQuery(
Expand Down
Loading