aboutsummaryrefslogtreecommitdiff
path: root/reproduce/analysis/make/delete-me.mk
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2019-04-15 01:47:58 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2019-04-15 02:24:09 +0100
commit313b936b502d22b6a2ff43f560dee0bb51fd01d0 (patch)
tree70f884b91b393be4d3c6b7cfaeaf3412900bd16f /reproduce/analysis/make/delete-me.mk
parent4722ea598edd6b630227404c48c1c09ac527e9b8 (diff)
New architecture to separate software-building and analysis steps
Until now, the software building and analysis steps of the pipeline were intertwined. However, these steps (of how to build a software, and how to use it) are logically completely independent. Therefore with this commit, the pipeline now has a new architecture (particularly in the `reproduce' directory) to emphasize this distinction: The `reproduce' directory now has the two `software' and `analysis' subdirectories and the respective parts of the previous architecture have been broken up between these two based on their function. There is also no more `src' directory. The `config' directory for software and analysis is now mixed with the language-specific directories. Also, some of the software versions were also updated after some checks with their webpages. This new architecture will allow much more focused work on each part of the pipeline (to install the software and to run them for an analysis).
Diffstat (limited to 'reproduce/analysis/make/delete-me.mk')
-rw-r--r--reproduce/analysis/make/delete-me.mk126
1 files changed, 126 insertions, 0 deletions
diff --git a/reproduce/analysis/make/delete-me.mk b/reproduce/analysis/make/delete-me.mk
new file mode 100644
index 0000000..c4cfffe
--- /dev/null
+++ b/reproduce/analysis/make/delete-me.mk
@@ -0,0 +1,126 @@
+# Dummy Makefile to create a random dataset for plotting.
+#
+# Copyright (C) 2018-2019 Mohammad Akhlaghi <mohammad@akhlaghi.org>
+#
+# This Makefile is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+#
+# This Makefile is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+# Public License for more details.
+#
+# A copy of the GNU General Public License is available at
+# <http://www.gnu.org/licenses/>.
+
+
+
+
+
+# Dummy dataset
+# -------------
+#
+# We will use AWK to generate a table showing X and X^2 and draw its plot.
+dmdir = $(texdir)/delete-me
+dm = $(dmdir)/data.txt
+$(dmdir): | $(texdir); mkdir $@
+$(dm): $(pconfdir)/delete-me-num.mk | $(dmdir)
+
+ # When the plotted values are re-made, it is necessary to also
+ # delete the TiKZ externalized files so the plot is also re-made.
+ rm -f $(tikzdir)/delete-me.pdf
+
+ # Generate the table of random values.
+ awk 'BEGIN {for(i=1;i<=$(delete-me-num);i+=0.5) print i, i*i; }' > $@
+
+
+
+
+
+# WFPC2 image PDF
+# -----------------
+#
+# For an example image, we'll make a PDF copy of the WFPC II image to
+# display in the paper.
+dddemodir = $(texdir)/delete-me-demo
+$(dddemodir): | $(texdir); mkdir $@
+demopdf = $(dddemodir)/wfpc2.pdf
+$(demopdf): $(dddemodir)/%.pdf: $(indir)/%.fits | $(dddemodir)
+
+ # When the plotted values are re-made, it is necessary to also
+ # delete the TiKZ externalized files so the plot is also re-made.
+ rm -f $(tikzdir)/delete-me-wfpc2.pdf
+
+ # Convert the dataset to a PDF.
+ astconvertt --colormap=gray --fluxhigh=4 $< -h0 -o$@
+
+
+
+
+
+# Histogram of WFPC2 image
+# ------------------------
+#
+# For an example plot, we'll show the pixel value histogram also.
+histogram = $(dddemodir)/wfpc2-hist.txt
+$(histogram): $(dddemodir)/%-hist.txt: $(indir)/%.fits | $(dddemodir)
+
+ # When the plotted values are re-made, it is necessary to also
+ # delete the TiKZ externalized files so the plot is also re-made.
+ rm -f $(tikzdir)/delete-me-wfpc2.pdf
+
+ # Generate the pixel value distribution
+ aststatistics --lessthan=5 $< -h0 --histogram -o$@
+
+
+
+
+
+# Basic statistics
+# ----------------
+#
+# This is just as a demonstration on how to get analysic configuration
+# parameters from variables defined in `reproduce/analysis/config/'.
+stats = $(dddemodir)/wfpc2-stats.txt
+$(stats): $(dddemodir)/%-stats.txt: $(indir)/%.fits | $(dddemodir)
+ aststatistics $< -h0 --mean --median > $@
+
+
+
+
+
+# TeX macros
+# ----------
+#
+# This is how we write the necessary parameters in the final PDF.
+#
+# NOTE: In LaTeX you cannot use any non-alphabetic character in a variable
+# name.
+$(mtexdir)/delete-me.tex: $(dm) $(demopdf) $(histogram) $(stats)
+
+ # Write the number of random values used.
+ echo "\newcommand{\deletemenum}{$(delete-me-num)}" > $@
+
+ # Note that since Make variables start with a `$(', if you want to
+ # use `$' within the shell (not Make), you have to quote any
+ # occurance of `$' with another `$'. That is why there are `$$' in
+ # the AWK command below.
+ #
+ # Here, we are first using AWK to find the minimum and maximum
+ # values, then using it again to read each separately to use in the
+ # macro definition.
+ mm=$$(awk 'BEGIN{min=99999; max=-min}
+ {if($$2>max) max=$$2; if($$2<min) min=$$2;}
+ END{print min, max}' $(dm));
+ v=$$(echo "$$mm" | awk '{printf "%.3f", $$1}');
+ echo "\newcommand{\deletememin}{$$v}" >> $@
+ v=$$(echo "$$mm" | awk '{printf "%.3f", $$2}');
+ echo "\newcommand{\deletememax}{$$v}" >> $@
+
+ # Write the statistics of the WFPC2 image as a macro.
+ mean=$$(awk '{printf("%.2f", $$1)}' $(stats))
+ echo "\newcommand{\deletemewfpctwomean}{$$mean}" >> $@
+ median=$$(awk '{printf("%.2f", $$2)}' $(stats))
+ echo "\newcommand{\deletemewfpctwomedian}{$$median}" >> $@