Commit 69a635ba authored by Mohammad Akhlaghi's avatar Mohammad Akhlaghi

Catalogs ready for plotting are created

Catalogs with HST and MUSE magnitudes and positions are now created
for the full UDF Mosaic and the UDF-10 field. The comments above the
rules are descriptive enough.
parent 2135a3ba
......@@ -183,5 +183,70 @@ $(catalogs): $(catdir)/%.txt: $(cutdir)/%.fits $$(call gensegname,%) \
file.txt: $(catalogs)
# Clean catalogs
# --------------
#
# Put the necessary columns of the HST and MUSE catalogs into the same
# file and remove those that have NaN measurements.
ccatdir = $(BDIR)/catalogs-cleaned
cleancats = $(foreach uid, 1 2 3 4 5 6 7 8 9 10, \
$(foreach f, $(filters), $(ccatdir)/udf$(uid)-$(f).txt) )
$(cleancats): $(ccatdir)/%.txt: $(catdir)/%-h.txt $(catdir)/%-m.txt | $(ccatdir)
# First merge the two catalogs of the same field and filter
# together into one file to make it easier to process them.
paste $(catdir)/$*-h.txt $(catdir)/$*-m.txt > $(ccatdir)/$*-pasted.txt
# Remove the comments and NaN magnitude results and keep the
# differences between the MUSE and HST positions and
# magnitudes.
subfield=$(subst udf,,$(word 1, $(subst -, ,$*))); \
awk 'BEGIN{ \
print "# Reproduction pipeline $(gitdescribe)."; \
print "# Column 1: Sub-field ID."; \
print "# Column 2: ID in segmentation map."; \
print "# Column 3: RA in degraded HST image."; \
print "# Column 4: Dec in degraded HST image."; \
print "# Column 5: Magnitude in degraded HST image."; \
print "# Column 6: RA_MUSE - RA_HST."; \
print "# Column 7: DEC_MUSE - DEC-HST."; \
print "# Column 8: MAG-MUSE - MAG_HST."; \
} \
!/^#/ && $$4!="nan" && $$8!="nan" { \
printf("%-4d%-5d%-14.8f%-14.8f%-8.3f%-14.8f%-14.8f%-8.3f\n", \
'$$subfield', $$1, $$2, $$3, $$4, $$6-$$2, $$7-$$3, \
$$8-$$4) }' $(ccatdir)/$*-pasted.txt > $@
# Clean up.
rm $(ccatdir)/$*-pasted.txt
# Full field comparisons
# ----------------------
#
# The cleaned catalogs were for one sub-field in each filter, so now
# we will merge the nine UDF subfields into one file. Note that the
# UDF10 field doesn't need any merging of catalogs, so the
# $(fullmosaic) rule is for the 9 subfields and $(fulludf) is just
# defined for easy dependencies at later steps.
fullmosaic = $(foreach f, $(filters), $(ccatdir)/udf-$(f).txt)
fulludf = $(fullmosaic) $(foreach f, $(filters), $(ccatdir)/udf10-$(f).txt)
$(fullmosaic): $(ccatdir)/udf-%.txt: $$(foreach i, 1 2 3 4 5 6 7 8 9, \
$(ccatdir)/udf$$(i)-%.txt )
# The comments are similar to all the catalogs, so just put
# those of the first prerequisite.
awk '/^#/{print}' $< > $@
# Put all the non-commented rows of each subfield.
for file in $^; do awk '!/^#/{print}' $$file >> $@; done
file.txt: $(fulludf)
@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