11#! /bin/bash
22# SBATCH --job-name=preproc
3- # SBATCH --account=PCON0003
3+ # SBATCH --account=PAS2340
44# SBATCH --time=48:00:00
55# SBATCH --nodes=1
66# SBATCH --ntasks-per-node=12
77
88# you can tell the script which SCA to use by setting:
99#
10- # sbatch --export=USE_SCA=10 make_sca_files .job
10+ # sbatch --export=USE_SCA=07 make_sca_files_install .job
1111#
1212# (this way you don't need to modify the script to run any of the SCAs)
1313# which SCA to use? (format: '01' .. '18' -- you are supposed to have the leading 0 for SCA<=9)
1414
1515# which read pattern to use? (format: string)
1616export READ_PATTERN_NAME=" IM_107_8"
1717# tag for this set of files (should be the same for all the SCAs)
18- export TAG=" DUMMY20250521 "
18+ export TAG=" DUMMY20251211 "
1919
2020# where we get the darks
2121export DARK_DIR=" /fs/scratch/PCON0003/cond0007/FPT-Darks"
@@ -24,11 +24,9 @@ export FLAT_DIR="/fs/scratch/PCON0003/cond0007/FPT-Flats"
2424# where we get the low-intensity flats
2525export LOFLAT_DIR=" /fs/scratch/PCON0003/cond0007/FPT-LoFlats"
2626# where we are sending the data
27- export TARGET_DIR=" /fs/scratch/PCON0003/cond0007/cal "
27+ export TARGET_DIR=" /fs/scratch/PCON0003/cond0007/cal_fall25 "
2828# where these scripts are located
2929export SCRIPT_DIR=" /users/PCON0003/cond0007/imcom/romanimpreprocess/runs/summer2025run"
30- # solid-waffle directory
31- export SOLID_WAFFLE_DIR=" /users/PCON0003/cond0007/solid-waffle"
3230
3331# tell the log some information
3432echo " --- Environment variable ---"
@@ -39,7 +37,6 @@ echo "DARK_DIR" $DARK_DIR
3937echo " FLAT_DIR" $FLAT_DIR
4038echo " TARGET_DIR" $TARGET_DIR
4139echo " SCRIPT_DIR" $SCRIPT_DIR
42- echo " SOLID_WAFFLE_DIR" $SOLID_WAFFLE_DIR
4340echo " "
4441
4542# make single FITS files of the darks and flats
@@ -52,7 +49,6 @@ python convert_loflt.py $LOFLAT_DIR 12 $TARGET_DIR $USE_SCA
5249
5350# set up solid-waffle
5451# This is for using 50 exposures.
55- cd $SCRIPT_DIR
5652pwd
5753echo " " > summary_files_$USE_SCA .txt; rm summary_files_$USE_SCA .txt # suppress warning
5854perl write_solid-waffle_config.pl $TARGET_DIR $USE_SCA 1 10 > config1_$USE_SCA .txt
@@ -62,7 +58,6 @@ perl write_solid-waffle_config.pl $TARGET_DIR $USE_SCA 31 40 > config4_$USE_SCA.
6258perl write_solid-waffle_config.pl $TARGET_DIR $USE_SCA 41 50 > config5_$USE_SCA .txt
6359# run solid-waffle
6460# This step can be parallelized
65- cd $SOLID_WAFFLE_DIR
6661python test_run.py $SCRIPT_DIR /config1_$USE_SCA .txt > $TARGET_DIR /sw-SCA$USE_SCA -P1.log &
6762python test_run.py $SCRIPT_DIR /config2_$USE_SCA .txt > $TARGET_DIR /sw-SCA$USE_SCA -P2.log &
6863python test_run.py $SCRIPT_DIR /config3_$USE_SCA .txt > $TARGET_DIR /sw-SCA$USE_SCA -P3.log &
7368rm $SCRIPT_DIR /config? _$USE_SCA .txt
7469
7570# now print the gain files
76- cd $SCRIPT_DIR
7771pwd
7872python make_gain_file.py summary_files_$USE_SCA .txt $USE_SCA $TARGET_DIR /roman_wfi_gain_$TAG \_ SCA$USE_SCA .asdf
7973# this is no longer needed
8074rm summary_files_$USE_SCA .txt
8175
8276# run the noise script
83- cd $SOLID_WAFFLE_DIR
84- pwd
85- python noise_run.py -f 6 -i $TARGET_DIR /99999999_SCA$USE_SCA \_ Noise_001.fits -o $TARGET_DIR /noise_SCA$USE_SCA .fits -n 100 -t 2 -cd 5.0 -rh 7 -tn 34 -ro
77+ python -m solid_waffle.noise_run -f 6 -i $TARGET_DIR /99999999_SCA$USE_SCA \_ Noise_001.fits -o $TARGET_DIR /noise_SCA$USE_SCA .fits -n 100 -t 2 -cd 5.0 -rh 7 -tn 34 -ro
8678# here:
8779# 6 = file format (consistent with FPS)
8880# $TARGET_DIR/99999999_SCA$USE_SCA\_Noise_001.fits = name of first noise file
@@ -95,25 +87,20 @@ python noise_run.py -f 6 -i $TARGET_DIR/99999999_SCA$USE_SCA\_Noise_001.fits -o
9587# -ro = include reference output in build
9688
9789# and generate histograms for the DNL
98- python histograms.py -f 6 -i $TARGET_DIR /99999999_SCA$USE_SCA \_ Noise_001.fits -o $TARGET_DIR /histD_SCA$USE_SCA .dat -n 100
99- python histograms.py -f 6 -i $TARGET_DIR /99999999_SCA$USE_SCA \_ LoFlat_001.fits -o $TARGET_DIR /histG_SCA$USE_SCA .dat -n 30
100- python histograms.py -f 6 -i $TARGET_DIR /99999999_SCA$USE_SCA \_ Flat_001.fits -o $TARGET_DIR /histF_SCA$USE_SCA .dat -n 50
90+ python -m solid_waffle.histograms -f 6 -i $TARGET_DIR /99999999_SCA$USE_SCA \_ Noise_001.fits -o $TARGET_DIR /histD_SCA$USE_SCA .dat -n 100
91+ python -m solid_waffle.histograms -f 6 -i $TARGET_DIR /99999999_SCA$USE_SCA \_ LoFlat_001.fits -o $TARGET_DIR /histG_SCA$USE_SCA .dat -n 30
92+ python -m solid_waffle.histograms -f 6 -i $TARGET_DIR /99999999_SCA$USE_SCA \_ Flat_001.fits -o $TARGET_DIR /histF_SCA$USE_SCA .dat -n 50
10193
10294# build the dark file
103- cd $SCRIPT_DIR
10495pwd
10596python make_dark_file.py IM_107_8 $TARGET_DIR /99999999_SCA$USE_SCA \_ Noise_001.fits $TARGET_DIR /noise_SCA$USE_SCA .fits $USE_SCA $TARGET_DIR /roman_wfi_dark_$TAG \_ SCA$USE_SCA .asdf
10697
10798# build the linearity files
108- cd $SCRIPT_DIR
10999pwd
110100perl write_linearity_config.pl $TARGET_DIR $USE_SCA $TAG > linearity_pars_$USE_SCA .json
111- cd $SOLID_WAFFLE_DIR
112- pwd
113- python linearity_run.py $SCRIPT_DIR /linearity_pars_$USE_SCA .json
101+ python -m solid_waffle.linearity_run $SCRIPT_DIR /linearity_pars_$USE_SCA .json
114102
115103# post-process these to get pflat and saturation
116- cd $SCRIPT_DIR
117104pwd
118105python postprocess_calfiles.py $TARGET_DIR /roman_wfi_linearitylegendre_$TAG \_ SCA$USE_SCA .asdf $USE_SCA $READ_PATTERN_NAME
119106python makemask.py $TARGET_DIR /roman_wfi_mask_$TAG \_ SCA$USE_SCA .asdf $USE_SCA $READ_PATTERN_NAME
0 commit comments