-
Notifications
You must be signed in to change notification settings - Fork 13
Run THELI on shapepipe part 1 #617
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
Open
lbaumo
wants to merge
11
commits into
CosmoStat:develop
Choose a base branch
from
lbaumo:weights
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+196
−38
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
acf7cda
no longer setting weights to 1 before rescaling
d5a2f07
tiny documentation change
94552f8
force tmp directory creation
922d8aa
bash script to convert theli book-keeping to shapepipe
60690b0
get_images works for theli
7ada850
change WCS from TAN to TPV
e679bbf
untested edits to merge_header module
031a918
convert _ to - in filenames
5daad5d
merge headers changes run so far
d6f4d94
merge_headers.py runs
b81a17a
remove file that was added by accident
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Name: find_exposures.sh | ||
# Description: Script to convert THELI images to shapepipe | ||
# bookkeeping conventions | ||
# Author: Lucie Baumont <[email protected]> | ||
# Date: v1.0 1/2023 | ||
|
||
|
||
# Command line arguments | ||
|
||
## Help string | ||
usage="Usage: $(basename "$0") THELI_DIR OUTPUT_DIR\n | ||
THELI_DIR\n | ||
\thome director of THELI images, eg. /n17data/baumont/THELI_W3/W3/CFISCOLLAB_V2.0.0A\n | ||
OUTPUT_DIR\n | ||
\troot directory where outputs will go \n | ||
" | ||
|
||
## Help if no arguments | ||
if [ -z $1 ]; then | ||
echo -ne $usage | ||
exit 1 | ||
fi | ||
theli_dir=$1 | ||
output_dir=$2 | ||
|
||
#make necessary directories | ||
mkdir -p ${output_dir}/tiles | ||
mkdir -p ${output_dir}/tiles/exposure_lists | ||
mkdir -p ${output_dir}/exposures | ||
mkdir -p ${output_dir}/exposures/headers | ||
|
||
for dir in ${theli_dir}/CFIS*; | ||
do | ||
# create link for all tiles and rename them | ||
coadd_dir=$dir/r.MP9602/coadd_V2.0.0A/ | ||
single_dir=${coadd_dir/coadd/single} | ||
echo $single_dir | ||
header_dir=${coadd_dir/coadd/headers} | ||
file=${coadd_dir}/*.cut.fits | ||
base=$(basename ${file} _r.MP9602.V2.0.0A.swarp.cut.fits) | ||
num_pattern=${base:5} | ||
num=${num_pattern//[-._]/} | ||
ln -s ${coadd_dir}/${base}_r.MP9602.V2.0.0A.swarp.cut.fits ${output_dir}/tiles/CFIS_$num.fits | ||
ln -s ${coadd_dir}/${base}_r.MP9602.V2.0.0A.swarp.cut.weight.fits ${output_dir}/tiles/CFIS_$num.weight.fits | ||
ln -s ${coadd_dir}/${base}_r.MP9602.V2.0.0A.swarp.cut.flag.fits ${output_dir}/tiles/CFIS_$num.flag.fits | ||
# create exposure list, link files but exclude broken links | ||
for file in $(find ${single_dir}/*.sub.fits -type l -not -xtype l); do | ||
base=$(basename $file C.sub.fits) | ||
weight_link=${single_dir}/${base}C.weight.fits.gz | ||
if [ -L ${weight_link} ] ; then | ||
if [ -e ${weight_link} ] ; then | ||
echo $(basename $file C.sub.fits) | ||
ln -s ${single_dir}/${base}C.sub.fits ${output_dir}/exposures | ||
ln -s ${single_dir}/${base}C.weight.fits.gz ${output_dir}/exposures | ||
# remove header line 2 which has french accents that cause problems with astropy, change wcs keys | ||
awk 'NR!~/^(2)$/ {sub(/TAN/,"TPV"); print}' ${header_dir}/${base}.head > ${output_dir}/exposures/headers/${base}.head | ||
|
||
fi | ||
fi | ||
done >> ${output_dir}/tiles/exposure_lists/exp_numbers-$num.txt | ||
|
||
#list=$(find ${single_dir}/*.sub.fits | awk -F/ '{print substr($NF,1,8)}'|uniq) | ||
#echo "${list}">exposure_lists/$num.txt | ||
|
||
done | ||
|
||
#uncompress step | ||
gunzip -f ${output_dir}/exposures/*.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will create an issue. Line 859 there is
weight_map *= 1 / sig_noise ** 2
if the weight_map is not equal to 1 it will lead to weird behavior.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for theli weights, there are relative weights between pixels, which then need to be rescaled by the sky background variance to become variance maps. Thomas Erban seemed to think this operation was okay. are you talking about the weirdness associated with some megaprime weight maps that are not always 1 or 0?