Commit 2c31a594 authored by Mohammad Akhlaghi's avatar Mohammad Akhlaghi
Browse files

Correct estimation of MUSE PSFs and deconvolution

The model MUSE PSFs were incorrectly calculated until now! I was
mistakenly assuming that the `FSF01FWA' was the FWHM. However, the
FWHM must be calculated from `b*lambda+a' where `b' is the value to
`FSF01FWB' keyword and `a' is the value of `FSF01FWA'. The effective
`lambda' (or wavelength) to use for each broad-band filter is the
throughput-weighted average wavelength of the filter.

So, the pipeline now uses the HST filter throughputs to find `lambda'
and then uses the values of these keywords to generate the proper FWHM
for the Moffat function. The throughputs will be downloaded if not
already available. The FWHMs decreased from around 14 pixels to around
10 pixels.

After implementing this correction, a test run of the deconvolution
gave a better result. The reason was that the image crop to feed into
the deconvolution algorithm was larger and so lower frequencies could
be sampled. After seeing this trend, I increased the truncation radius
of the model MUSE PSFs and also the deconvolution image size and saw
that the deconvolution output kernel is becoming better and better. I
finally stopped at 6 times the FWHM since it was apparently not making
much more change.

So, now the proper kernel to convolve with the HST images is created
and we can directly compare the results with the MUSE images without
worrying about a larger PSF. After convolution, the HST images are now
also sampled to the same pixel size as MUSE.
parent 42f5ffb5
......@@ -48,15 +48,16 @@ all: $(BSYM) file.txt
# Top build directories
# ---------------------
# Top directories under BDIR
# --------------------------
#
# The outputs of the separate steps will be in the build directory. We
# don't want to repeatedly call a command to build those directories,
# so we are defining a pattern rule to do the job for all. Just note
# that it is important that you do not put a `/' after the directory
# name when defining its variable, since in a pattern rule, `/' will
# not match.
# so we are defining a pattern rule to do the job for any similarly
# formatted directory. Just note that it is important that you do not
# put a `/' after the directory name when defining its variable, since
# in a pattern rule, an ending `/' will not match. Add the `/'
# everytime you want to call the directory variable.
$(BDIR)/%: | $(BDIR);
mkdir $@
......
......@@ -24,13 +24,15 @@
# Survey directories
#
# This is where the survey images (with the same file-name standard as
# the main webpage) are stored. If this directory doesn't exist, or it
# doesn't contain the images (with the correct file-name formats), it
# will be created and the images will be downloaded. See
# `src/downloads.mk', for the URLs containing the expected inputs for
# each survey.
# This is where the survey images and necessary files (with the same
# file-name standard as the main webpage) are stored. If this
# directory doesn't exist, or it doesn't contain the images (with the
# correct file-name formats), it will be created and the images will
# be downloaded. See `src/downloads.mk', for the URLs containing the
# expected inputs for each survey.
XDF = /home/mohammad/work/datasets/xdf
TROUGHPUTS = /home/mohammad/work/datasets/hst-throughputs
MUSEINPUTS = /home/mohammad/work/datasets/muse-udf-photometry
......@@ -56,12 +58,3 @@ BDIR = /home/mohammad/work/builds/muse-udf-photometry
# link. If the value is empty (nothing after the `=' sign) then no
# symbolic link will be created.
BSYM = reproduce/build
# MUSE inputs
#
# Directory keeping all the input MUSE images.
MUSEINPUTS = /home/mohammad/work/datasets/muse-udf-photometry
# Configuration files for programs
mkprof = reproduce/config/gnuastro/astmkprof.conf
arithmetic = reproduce/config/gnuastro/astarithmetic.conf
convolve = reproduce/config/gnuastro/astconvolve.conf
header = reproduce/config/gnuastro/astheader.conf
imgcrop = reproduce/config/gnuastro/astimgcrop.conf
imgwarp = reproduce/config/gnuastro/astimgwarp.conf
mkcatalog = reproduce/config/gnuastro/astmkcatalog.conf
mkprof = reproduce/config/gnuastro/astmkprof.conf
noisechisel = reproduce/config/gnuastro/astnoisechisel.conf
......@@ -2,4 +2,4 @@
#
# The reason it is in units of 0.01 arcseconds is that we want to use
# it in the filenames and this makes it easy.
hstpixelscale = 3
hstpixelscale = 6
# The size of the PSFs from MUSE and HST to match.
psf-match-width = 71
psf-match-width = 51
# Truncation radius for generating the MUSE PSF
#
# This is in units of the FWHM.
truncation-muse-psf = 3
truncation-muse-psf = 6
......@@ -24,11 +24,39 @@
# Get the PSF information from the headers
# Throughput effective wavelength
# -------------------------------
#
# We need one wavelength to generate the parametric MUSE PSF. So we
# will take the throughput-weighted average wavelength for the
# job. Unfortunately in the STSCI throughput filenames, there letters
# are all upper-case. So we have to deal with the throughputs
# separately.
leffdir=$(BDIR)/lambda-eff
lambda-eff = $(leffdir)/$(lastword $(filters)).txt
$(lambda-eff): $(throughputs) | $(leffdir)
# Find the throughput weighted average for each filter.
for f in $(filters); do \
awk '{sum+=$$1*$$2; sumw+=$$2;} END{print(sum/sumw)}' \
$(TROUGHPUTS)/wfc_$$(echo $$f | tr a-z A-Z).dat \
> $(leffdir)/$$f.txt; \
done
# MUSE PSF information from headers
# ---------------------------------
#
# The MUSE PSF is given in terms of Moffat function parameters in the
# headers of the input images. So we have to pull those parameters out
# first.
mpsfdir = $(BDIR)/muse-psfs
all-muse-udf-psfs = $(foreach f, $(filters), $(MUSEINPUTS)/muse-udf-$(f).fits) \
$(foreach f, $(filters), $(MUSEINPUTS)/muse-udf10-$(f).fits)
$(mpsfdir)/muse-psfs.txt: $(all-muse-udf-psfs) \
$(mpsfdir)/muse-psfs.txt: $(all-muse-udf-psfs) $(lambda-eff) \
reproduce/config/internal/truncation-muse-psf.mk \
reproduce/config/internal/hst-pixel-scale.mk \
| $(mpsfdir)
......@@ -39,25 +67,31 @@ $(mpsfdir)/muse-psfs.txt: $(all-muse-udf-psfs) \
# Write the information for each PSF in the file. The
# MakeProfiles columns are defined in its configuration file.
for file in $(filter %.fits, $^); do \
astheader $$file | grep FSF | \
awk 'BEGIN{print "#", "'$$file'"; bc=0; fc=0;} \
/FSF0.BET/ {beta[bc++]=$$NF} \
/FSF0.FWA/ {fwhm[fc++]=$$NF} \
END{ \
topixel=1/(0.01*$(hstpixelscale)); \
for(i=0;i<bc;++i) \
printf("1 0 0 1 %.3f %.3f 0 1 0 %.3f\n", \
fwhm[i]*topixel, beta[i], \
$(truncation-muse-psf)); \
}' >> $@; \
for uid in udf udf10; do \
for f in $(filters); do \
file=$(MUSEINPUTS)/muse-$$uid"-"$$f".fits"; \
lambda=$$(cat $(leffdir)/$$f.txt); \
astheader $$file | grep FSF | \
awk 'BEGIN{print "#", "'$$file'"; bc=0; Ac=0; Bc=0;} \
/FSF0.BET/ {beta[bc++]=$$NF} \
/FSF0.FWA/ {A[Ac++]=$$NF} \
/FSF0.FWB/ {B[Bc++]=$$NF} \
END{ \
topixel=1/(0.01*$(hstpixelscale)); \
for(i=0;i<bc;++i) \
printf("1 0 0 1 %.3f %.3f 0 1 0 %.3f\n", \
(B[i]*'$$lambda'+A[i])*topixel, beta[i], \
$(truncation-muse-psf)); \
}' >> $@; \
done; \
done
# Make the MUSE PSFs.
# Make the MUSE PSFs
# ------------------
#
# The random number generator and seed must be fixed to get exactly
# the same results. For the seed, I just typed in some numbers to make
......@@ -123,6 +157,7 @@ $(muse-rawpsfs): $(mpsfdir)/muse-psfs.txt $(mkprof)
# Cutout the MUSE PSFs to the proper size
# ---------------------------------------
#
# The size of the images created by MakeProfiles was based on the PSF
# FWHM. But to match with the HST PSF, we need a different size (set
......@@ -147,27 +182,87 @@ $(muse-psfs): %.fits: $(muse-rawpsfs) \
######################################################################
#################### Ignored rules for now ####################
################ | ################
################ \ / ################
################ . ################
######################################################################
# HST PSF
# Original HST images of each region
# ----------------------------------
#
# Cutout the original HST images.
hcutdir = $(BDIR)/hst-cutouts
xdf-prefix = $(XDF)/hlsp_xdf_hst_acswfc-$(hstpixelscale)0mas_hudf_
udf1-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf1-$(f)-o.fits)
$(udf1-hst-cutouts): $(hcutdir)/udf1-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf1.mk \
| $(hcutdir)
astimgcrop $(udf1polygon) $< -o$@
udf2-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf2-$(f)-o.fits)
$(udf2-hst-cutouts): $(hcutdir)/udf2-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf2.mk \
| $(hcutdir)
astimgcrop $(udf2polygon) $< -o$@
udf3-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf3-$(f)-o.fits)
$(udf3-hst-cutouts): $(hcutdir)/udf3-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf3.mk \
| $(hcutdir)
astimgcrop $(udf3polygon) $< -o$@
udf4-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf4-$(f)-o.fits)
$(udf4-hst-cutouts): $(hcutdir)/udf4-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf4.mk \
| $(hcutdir)
astimgcrop $(udf4polygon) $< -o$@
udf5-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf5-$(f)-o.fits)
$(udf5-hst-cutouts): $(hcutdir)/udf5-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf5.mk \
| $(hcutdir)
astimgcrop $(udf5polygon) $< -o$@
udf6-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf6-$(f)-o.fits)
$(udf6-hst-cutouts): $(hcutdir)/udf6-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf6.mk \
| $(hcutdir)
astimgcrop $(udf6polygon) $< -o$@
udf7-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf7-$(f)-o.fits)
$(udf7-hst-cutouts): $(hcutdir)/udf7-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf7.mk \
| $(hcutdir)
astimgcrop $(udf7polygon) $< -o$@
udf8-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf8-$(f)-o.fits)
$(udf8-hst-cutouts): $(hcutdir)/udf8-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf8.mk \
| $(hcutdir)
astimgcrop $(udf8polygon) $< -o$@
udf9-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf9-$(f)-o.fits)
$(udf9-hst-cutouts): $(hcutdir)/udf9-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf9.mk \
| $(hcutdir)
astimgcrop $(udf9polygon) $< -o$@
udf10-hst-cutouts = $(foreach f, $(filters), $(hcutdir)/udf10-$(f)-o.fits)
$(udf10-hst-cutouts): $(hcutdir)/udf10-%-o.fits: $(xdf-prefix)%_v1_sci.fits \
$(imgcrop) reproduce/config/internal/vertices-udf10.mk \
| $(hcutdir)
astimgcrop $(udf10polygon) $< -o$@
# HST PSFs
# --------
#
# Crop out one star from the HST image, center it and then use it for
# the HST PSF.
hpsfdir=$(BDIR)/hst-psfs
xdf-prefix = $(XDF)/hlsp_xdf_hst_acswfc-$(hstpixelscale)0mas_hudf_
hst-star-cats = $(foreach f, $(filters), $(hpsfdir)/star-$(f).txt)
$(hst-star-cats): $(hpsfdir)/star-%.txt: $(xdf-prefix)%_v1_sci.fits \
reproduce/config/internal/hst-star-position.mk \
reproduce/config/internal/star-cat-threshold.mk | $(hpsfdir)
reproduce/config/internal/star-cat-threshold.mk \
$(imgcrop) $(noisechisel) $(mkcatalog) | $(hpsfdir)
# Crop the region in the vicinity of the star in a large
# enough box that the Sky can be accurate calculated. A width
......@@ -175,8 +270,13 @@ $(hst-star-cats): $(hpsfdir)/star-%.txt: $(xdf-prefix)%_v1_sci.fits \
astimgcrop --ra=$(hst-star-ra) --dec=$(hst-star-dec) --wwidth=15 \
$< -o$(@D)/$*-l.fits
# Run NoiseChisel on the image
astnoisechisel $(@D)/$*-l.fits
# Run NoiseChisel on the image. We don't care about low
# surface brightness regions here, we just want the high S/N
# star regions, so we are setting really loose parameters
# which are necessary for some stars in the 0.06''/pixel
# images.
astnoisechisel $(@D)/$*-l.fits --minbfrac=0.2 --minmodeq=0.48 \
--detsnminarea=5 --segsnminarea=5
# Make a catalog. Note that since we want the center of the
# star to be measured accurately, we use a very large
......@@ -187,7 +287,7 @@ $(hst-star-cats): $(hpsfdir)/star-%.txt: $(xdf-prefix)%_v1_sci.fits \
# The star should be in the central position: the object
# closest to the coordinates (250,250). Since this is a bright
# star, we don't expect any star within a few pixels.
awk '!/^#/ && $$2>248 && $$2<252 && $$3>248 && $$3<252 \
awk '!/^#/ && $$2>123 && $$2<127 && $$3>123 && $$3<127 \
{print $$2, $$3}' $(@D)/$*-l_labeled_c.txt > $@
# Clean up and set final name
......@@ -209,13 +309,13 @@ $(hst-centered-star): $(hpsfdir)/star-%.fits: $(hpsfdir)/star-%.txt \
# an example, when the position along an axis is 250.479, we
# need to translate the grid by 250-250.479 = -0.479 so the
# center of the star moves to the center of the pixel.
iwopts=$$(awk '{printf("--translate=%.3f,%.3f", 250-$$1, 250-$$2)}' \
iwopts=$$(awk '{printf("--translate=%.3f,%.3f", 125-$$1, 125-$$2)}' \
$<); \
astimgwarp $(@D)/$*-l.fits $$iwopts -o$(@D)/$*-w.fits
# Crop the centeral few pixels of the image to exactly
# pinpoint the center.
astimgcrop --xc=250 --yc=250 $(@D)/$*-w.fits --iwidth=5
astimgcrop --xc=125 --yc=125 $(@D)/$*-w.fits --iwidth=5
astconvertt $(@D)/$*-w_crop.fits -o$(@D)/$*-c.txt
rm $(@D)/$*-w_crop.fits
......@@ -225,7 +325,7 @@ $(hst-centered-star): $(hpsfdir)/star-%.fits: $(hpsfdir)/star-%.txt \
for(cc=1;cc<=NF;++cc) \
if($$cc>max) {max=$$cc; xc=cc; yc=rc;} \
} \
END{printf "--xc=%d --yc=%d", 250+xc-3, 250+yc-3}' \
END{printf "--xc=%d --yc=%d", 125+xc-3, 125+yc-3}' \
$(@D)/$*-c.txt); \
astimgcrop $$xyc $(@D)/$*-w.fits --iwidth=$(psf-match-width) -o$@
......@@ -250,18 +350,27 @@ $(kernels): $(kerneldir)/udf%.fits: $(mpsfdir)/udf%.fits \
# Get the HST image name and find the kernel
filter=$(word 2, $(subst -, , $*)); \
astconvolve --kernel=$(hpsfdir)/star-$$filter".fits" $< \
--makekernel=8 --viewfreqsteps -o$@
--makekernel=15 --viewfreqsteps -o$@
######################################################################
################ . ################
################ / \ ################
################ | ################
#################### Ignored rules for now ####################
######################################################################
file.txt: $(muse-psfs)
echo; echo "-- REACHED THE END ---"; echo
# Convolve HST images with proper PSF
# -----------------------------------
#
# The original HST cutouts are currently in their full resolution, so
# we need to convolve them with the MUSE PSFs (which were made in the
# HST resolution). Note that we will use spatial convolution because
# of NaN values and also edge effects. We are also running convolve on
# one thread so the multiple running on multiple threads can speed
# things up better.
hst-convolved = $(foreach uid, 1 2 3 4 5 6 7 8 9 10, \
$(foreach f, $(filters), $(hcutdir)/udf$(uid)-$(f)-c.fits) )
$(hst-convolved): $(hcutdir)/%-c.fits: $(hcutdir)/%-o.fits $(mpsfdir)/%.fits
astconvolve --spatial $< --kernel=$(kerneldir)/$*.fits -o$@ -N1
......@@ -23,8 +23,13 @@
# Identify the downloader tool
# ----------------------------
# Downloader and lock
# -------------------
#
# See if the downloader tools are ready and set them
# accordingly. Afterwards, define the lock directory for operations
# that must not be done in parallel.
locks = $(BDIR)/locks
downloader := $(shell if type curl > /dev/null; then downloader="curl -o"; \
else downloader="wget -O"; \
fi; echo "$$downloader"; )
......@@ -43,3 +48,16 @@ allxdf = $(foreach f, $(xdfacs), $(XDF)/$(xdfacspre)$(f)_v1_sci.fits) \
$(XDF):; mkdir $@
$(allxdf): $(XDF)/%: | $(XDF) $(locks)
flock $(locks)/download -c "$(downloader) $@ $(xdfweb)/$*"
# Filter throughputs
# ------------------
throughputsweb = http://www.stsci.edu/hst/acs/analysis/throughputs/tables
filtersup := $(shell for f in $(filters); do echo $$f | tr a-z A-Z; done)
throughputs = $(foreach F, $(filtersup), $(TROUGHPUTS)/wfc_$(F).dat)
$(TROUGHPUTS):; mkdir $@
$(throughputs): $(TROUGHPUTS)/%: | $(TROUGHPUTS) $(locks)
flock $(locks)/download -c "$(downloader) $@ $(throughputsweb)/$*"
......@@ -24,12 +24,6 @@
# Top level directory for all cutouts.
indir = $(BDIR)/input-cutouts
# Align the MUSE UDF region
# -------------------------
......@@ -49,69 +43,105 @@ $(udfaligned): $(audfdir)/muse-udf-%.fits: \
# From original MUSE images
# -------------------------
#
# Cutout the 10 udf regions
udf1-muse-cutouts = $(foreach f, $(filters), $(indir)/udf1-$(f)-m.fits)
$(udf1-muse-cutouts): $(indir)/udf1-%-m.fits: $(audfdir)/muse-udf-%.fits \
# Cutout the original MUSE images.
mcutdir = $(BDIR)/muse-cutouts
udf1-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf1-$(f).fits)
$(udf1-muse-cutouts): $(mcutdir)/udf1-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf1.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf1polygon) $< -o$@
udf2-muse-cutouts = $(foreach f, $(filters), $(indir)/udf2-$(f)-m.fits)
$(udf2-muse-cutouts): $(indir)/udf2-%-m.fits: $(audfdir)/muse-udf-%.fits \
udf2-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf2-$(f).fits)
$(udf2-muse-cutouts): $(mcutdir)/udf2-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf2.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf2polygon) $< -o$@
udf3-muse-cutouts = $(foreach f, $(filters), $(indir)/udf3-$(f)-m.fits)
$(udf3-muse-cutouts): $(indir)/udf3-%-m.fits: $(audfdir)/muse-udf-%.fits \
udf3-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf3-$(f).fits)
$(udf3-muse-cutouts): $(mcutdir)/udf3-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf3.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf3polygon) $< -o$@
udf4-muse-cutouts = $(foreach f, $(filters), $(indir)/udf4-$(f)-m.fits)
$(udf4-muse-cutouts): $(indir)/udf4-%-m.fits: $(audfdir)/muse-udf-%.fits \
udf4-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf4-$(f).fits)
$(udf4-muse-cutouts): $(mcutdir)/udf4-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf4.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf4polygon) $< -o$@
udf5-muse-cutouts = $(foreach f, $(filters), $(indir)/udf5-$(f)-m.fits)
$(udf5-muse-cutouts): $(indir)/udf5-%-m.fits: $(audfdir)/muse-udf-%.fits \
udf5-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf5-$(f).fits)
$(udf5-muse-cutouts): $(mcutdir)/udf5-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf5.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf5polygon) $< -o$@
udf6-muse-cutouts = $(foreach f, $(filters), $(indir)/udf6-$(f)-m.fits)
$(udf6-muse-cutouts): $(indir)/udf6-%-m.fits: $(audfdir)/muse-udf-%.fits \
udf6-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf6-$(f).fits)
$(udf6-muse-cutouts): $(mcutdir)/udf6-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf6.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf6polygon) $< -o$@
udf7-muse-cutouts = $(foreach f, $(filters), $(indir)/udf7-$(f)-m.fits)
$(udf7-muse-cutouts): $(indir)/udf7-%-m.fits: $(audfdir)/muse-udf-%.fits \
udf7-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf7-$(f).fits)
$(udf7-muse-cutouts): $(mcutdir)/udf7-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf7.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf7polygon) $< -o$@
udf8-muse-cutouts = $(foreach f, $(filters), $(indir)/udf8-$(f)-m.fits)
$(udf8-muse-cutouts): $(indir)/udf8-%-m.fits: $(audfdir)/muse-udf-%.fits \
udf8-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf8-$(f).fits)
$(udf8-muse-cutouts): $(mcutdir)/udf8-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf8.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf8polygon) $< -o$@
udf9-muse-cutouts = $(foreach f, $(filters), $(indir)/udf9-$(f)-m.fits)
$(udf9-muse-cutouts): $(indir)/udf9-%-m.fits: $(audfdir)/muse-udf-%.fits \
udf9-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf9-$(f).fits)
$(udf9-muse-cutouts): $(mcutdir)/udf9-%.fits: $(audfdir)/muse-udf-%.fits \
$(imgcrop) reproduce/config/internal/vertices-udf9.mk \
| $(indir)
| $(mcutdir)
astimgcrop $(udf9polygon) $< -o$@
udf10-muse-cutouts = $(foreach f, $(filters), $(indir)/udf10-$(f)-m.fits)
$(udf10-muse-cutouts): $(indir)/udf10-%-m.fits: \
udf10-muse-cutouts = $(foreach f, $(filters), $(mcutdir)/udf10-$(f).fits)
$(udf10-muse-cutouts): $(mcutdir)/udf10-%.fits: \
$(MUSEINPUTS)/muse-udf10-%.fits $(imgcrop) \
reproduce/config/internal/vertices-udf10.mk | $(indir)
reproduce/config/internal/vertices-udf10.mk | $(mcutdir)
astimgcrop $(udf10polygon) -h1 $< -o$@
udf-muse-cutouts = $(udf1-muse-cutouts) $(udf2-muse-cutouts) \
$(udf3-muse-cutouts) $(udf4-muse-cutouts) \
$(udf5-muse-cutouts) $(udf6-muse-cutouts) \
$(udf7-muse-cutouts) $(udf8-muse-cutouts) \
$(udf9-muse-cutouts) $(udf10-muse-cutouts)
# MUSE pixel resolution
# ---------------------
#
# For the final degrading of HST images, we also need the MUSE pixel
# resolution, so read the MUSE pixel resolution from one of the
# aligned images, then also read the HST pixel resolution from one of
# the images and find scale factor
$(hcutdir)/pix-res-scale.txt: $(mcutdir)/udf1-f606w.fits \
$(hcutdir)/udf1-f606w-c.fits
mres=$$(astheader $(mcutdir)/udf1-f606w.fits | grep PC2_2 \
| awk '{print $$3*3600}'); \
hres=$$(astheader $(hcutdir)/udf1-f606w-c.fits | grep PC2_2 \
| awk '{print $$3*3600}'); \
echo | awk '{print '$$hres'/'$$mres'}' > $@
# HST images to MUSE resolution
# -----------------------------
#
# The HST images were convolved with the MUSE PSF for the same spatial
# resolution, now, we need to warp them to the MUSE pixel grid to get
# be able to easily use one segmentation map over both images.
h-to-m-pixres = $(foreach uid, 1 2 3 4 5 6 7 8 9 10, \
$(foreach f, $(filters), $(hcutdir)/udf$(uid)-$(f).fits) )
$(h-to-m-pixres): %.fits: %-c.fits $(hcutdir)/pix-res-scale.txt
scalefactor=$$(cat $(hcutdir)/pix-res-scale.txt); \
astimgwarp $< --scale=$$scalefactor -o $@ --numthreads=1
file.txt: $(hst-convolved)
@echo; echo "reached end"; echo;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment