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

Karr/pupil imaging #100

Merged
merged 9 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
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
15 changes: 9 additions & 6 deletions .github/workflows/run_edps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
export PYESOREX_PLUGIN_DIR="$(pwd)/metisp/pyrecipes/"
export PYCPL_RECIPE_DIR="$(pwd)/metisp/pyrecipes/"
export PYTHONPATH="$(pwd)/metisp/pymetis/src/"
export SOF_DATA="$(pwd)/METIS_Pipeline_Test_Data/small202402/outputSmall"
export SOF_DIR="$(pwd)/METIS_Pipeline_Test_Data/small202402/sofFiles"
export SOF_DATA="$(pwd)/METIS_Pipeline_Test_Data/small202402/outputSmall/"
export SOF_DIR="$(pwd)/METIS_Pipeline_Test_Data/small202402/sofFiles/"
export PYESOREX_OUTPUT_DIR="$SOF_DATA"
python -m pytest -s
- name: Run pyESOREX test
Expand All @@ -48,8 +48,8 @@ jobs:
export PYESOREX_PLUGIN_DIR="$(pwd)/metisp/pyrecipes/"
export PYCPL_RECIPE_DIR="$(pwd)/metisp/pyrecipes/"
export PYTHONPATH="$(pwd)/metisp/pymetis/src/"
export SOF_DATA="$(pwd)/METIS_Pipeline_Test_Data/small202402/outputSmall"
export SOF_DIR="$(pwd)/METIS_Pipeline_Test_Data/small202402/sofFiles"
export SOF_DATA="$(pwd)/METIS_Pipeline_Test_Data/small202402/outputSmall/"
export SOF_DIR="$(pwd)/METIS_Pipeline_Test_Data/small202402/sofFiles/"
export PYESOREX_OUTPUT_DIR="$SOF_DATA"
pyesorex --recipes

Expand All @@ -73,14 +73,17 @@ jobs:
# CAL RECIPES
cat "${SOF_DIR}/metis_cal_chophome.sof"
pyesorex metis_cal_chophome "${SOF_DIR}/metis_cal_chophome.sof"
# PUPIL IMAGING
cat "${SOF_DIR}/metis_pupil_imaging.lm.sof"
pyesorex metis_pupil_imaging "${SOF_DIR}/metis_pupil_imaging.lm.sof"
- name: Run EDPS
run: |
# . metispipe/bin/activate
export PYESOREX_PLUGIN_DIR="$(pwd)/metisp/pyrecipes/"
export PYCPL_RECIPE_DIR="$(pwd)/metisp/pyrecipes/"
export PYTHONPATH="$(pwd)/metisp/pymetis/src/"
export SOF_DATA="$(pwd)/METIS_Pipeline_Test_Data/small202402/outputSmall"
export SOF_DIR="$(pwd)/METIS_Pipeline_Test_Data/small202402/sofFiles"
export SOF_DATA="$(pwd)/METIS_Pipeline_Test_Data/small202402/outputSmall/"
export SOF_DIR="$(pwd)/METIS_Pipeline_Test_Data/small202402/sofFiles/"
edps -lw
edps -w metis.metis_wkf -i $SOF_DATA -c
edps -w metis.metis_wkf -i $SOF_DATA -lt
Expand Down
5 changes: 1 addition & 4 deletions metisp/metis_pupil_imaging.lm.sof
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
$SOF_DATA/METIS.LM_PUPIL_RAW.2024-01-02_00_42_55.fits LM_PUPIL_RAW
$SOF_DATA/MASTER_DARK_2RG.fits MASTER_DARK_2RG
$SOF_DATA/MASTER_IMG_FLAT_LAMP_LM.fits MASTER_IMG_FLAT_LAMP_LM
$SOF_DATA/LINEARITY_2RG.fits LINEARITY_2RG
$SOF_DATA/METIS.LM_PUPIL_RAW.2027-01-25_00_02_23.fits LM_PUPIL_RAW
$SOF_DATA/GAIN_MAP_2RG.fits GAIN_MAP_2RG
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@

import cpl
from cpl.core import Msg
import re

from pymetis.base.recipe import MetisRecipe
from pymetis.base.product import PipelineProduct
from pymetis.inputs import RawInput
from pymetis.inputs.common import MasterDarkInput, LinearityInput, PersistenceMapInput, GainMapInput, MasterFlatInput
from pymetis.prefab.darkimage import DarkImageProcessor


class MetisPupilImagingImpl(DarkImageProcessor):
class InputSet(DarkImageProcessor.InputSet):
"""
Expand Down Expand Up @@ -167,7 +167,7 @@ def process_images(self) -> Dict[str, PipelineProduct]:

flat = self.prepare_flat(flat, bias)
images = self.prepare_images(self.inputset.raw.frameset, flat, bias)
combined_image = self.combine_images(images, self.parameters["pupil_imaging.stacking.method"].value)
combined_image = self.combine_images(images, self.parameters["metis_pupil_imaging.stacking.method"].value)
header = cpl.core.PropertyList.load(self.inputset.raw.frameset[0].file, 0)

self.products = {
Expand Down
65 changes: 2 additions & 63 deletions metisp/workflows/metis/metis_pupil_imaging_wkf.py
Original file line number Diff line number Diff line change
@@ -1,82 +1,21 @@
from edps import SCIENCE, QC1_CALIB, QC0, CALCHECKER
from edps import task, data_source, classification_rule
from .metis_lm_img_wkf import *

detlin_class = classification_rule("DETLIN_2RG_RAW",
{"instrume":"METIS",
"dpr.catg": "CALIB",
"dpr.type":"DETLIN",
"dpr.tech":"IMAGE,LM",
})

rawdark_class = classification_rule("DARK_2RG_RAW",
{"instrume":"METIS",
"dpr.catg": "CALIB",
"dpr.type":"DARK",
"dpr.tech":"IMAGE,LM",
})

lm_lampflat_class = classification_rule("LM_FLAT_LAMP_RAW",
{"instrume":"METIS",
"dpr.catg":"CALIB",
"dpr.type":"FLAT,LAMP",
"dpr.tech":"IMAGE,LM",
})

twlightflat_class = classification_rule("TWLIGHT_FLAT",
{"instrume":"METIS",
"dpr.catg": "CALIB",
"dpr.type":"FLAT,TWILIGHT",
"dpr.tech":"IMAGE,LM",
})

lm_pupil_class = classification_rule("LM_PUPIL_RAW",
{"instrume":"METIS",
"dpr.catg":"TECHNICAL",
"dpr.type":"PUPIL",
"dpr.tech":"PUP,M",
"dpr.tech":"PUP,LM",
})


# --- Data sources ---
detlin_raw = (data_source()
.with_classification_rule(detlin_class)
.with_match_keywords(["instrume","det.dit","det.ndit"])
.build())

raw_dark = (data_source()
.with_classification_rule(rawdark_class)
.with_match_keywords(["instrume"])
.build())

lm_lamp_flat = (data_source()
.with_classification_rule(lm_lampflat_class)
.with_match_keywords(["instrume"])
.build())


lm_raw_pupil = (data_source()
.with_classification_rule(lm_pupil_class)
.with_match_keywords(["instrume"])
.build())

# --- Processing tasks ---
dark_task = (task('metis_det_dark')
.with_main_input(raw_dark)
.with_recipe("metis_det_dark")
.build())

lingain_task = (task('metis_det_detlin')
.with_main_input(detlin_raw)
.with_associated_input(dark_task)
.with_recipe("metis_det_lingain")
.build())

flat_task = (task("metis_lm_img_flat")
.with_main_input(lm_lamp_flat)
.with_associated_input(dark_task)
.with_recipe("metis_lm_img_flat")
.build())

pupil_imaging = (task('metis_pupil_imaging')
.with_recipe('metis_pupil_imaging')
.with_main_input(lm_raw_pupil)
Expand Down
4 changes: 3 additions & 1 deletion metisp/workflows/metis/metis_wkf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@

from .metis_datasources import *
from .metis_lm_img_wkf import *
from .metis_lm_ifu_wkf import *

from .metis_pupil_imaging_wkf import *
from .metis_lm_ifu_wkf import *
Loading