From a60db913794a7e0563a5c3443311a955a98559f5 Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Sun, 25 Nov 2018 18:28:04 +0000 Subject: More generic naming convention Until now, we were keeping the input file within the reproduction pipeline's directories using the same name as the database/server. Now, we are using a short/summarized filename convention for the input dataset. --- paper.tex | 24 +++++++-------- reproduce/config/pipeline/delete-me-wfpc2-quant.mk | 2 -- reproduce/config/pipeline/filters.mk | 25 ---------------- reproduce/src/make/delete-me.mk | 30 ++++++++----------- reproduce/src/make/download.mk | 34 +++++++++++++--------- tex/delete-me-demo.tex | 34 ++++++++++++++++++++++ tex/delete-me-wfpc2.tex | 34 ---------------------- 7 files changed, 78 insertions(+), 105 deletions(-) delete mode 100644 reproduce/config/pipeline/delete-me-wfpc2-quant.mk delete mode 100644 reproduce/config/pipeline/filters.mk create mode 100644 tex/delete-me-demo.tex delete mode 100644 tex/delete-me-wfpc2.tex diff --git a/paper.tex b/paper.tex index 32a3465..97077d2 100644 --- a/paper.tex +++ b/paper.tex @@ -85,14 +85,14 @@ or in this way, will let you focus clearly on your science and not have to worry about fixing this or that number/name in the text. -Figure \ref{deleteme} shows a simple plot as a demonstration of creating +Figure \ref{delete-me} shows a simple plot as a demonstration of creating plots within \LaTeX{} (using the {\small PGFP}lots package). The minimum value in this distribution is $\deletememin$, and $\deletememax$ is the maximum. Take a look into the \LaTeX{} source and you'll see these numbers are actually macros that were calculated from the same dataset (they will change if the dataset, or function that produced it, changes). -The individual {\small PDF} file of Figure \ref{deleteme} is available +The individual {\small PDF} file of Figure \ref{delete-me} is available under the \texttt{tex/build/tikz/} directory of your build directory. You can use this PDF file in other contexts (for example in slides showing your progress or after publishing the work). If you want to directly use the @@ -103,11 +103,11 @@ progress or after publishing the work). If you want to directly use the \begin{figure}[t] \includetikz{delete-me} - \captionof{figure}{\label{deleteme} A very basic $X^2$ plot for + \captionof{figure}{\label{delete-me} A very basic $X^2$ plot for demonstration.} \end{figure} -Figure \ref{deleteme-wfpc2} is another demonstration of showing images +Figure \ref{delete-me-demo} is another demonstration of showing images (datasets) using PGFPlots. It shows a small crop of an image from the Wide-Field Planetary Camera 2, on board the Hubble Space Telescope from 1993 to 2009. This cropped image is one of the sample FITS files from the @@ -116,13 +116,11 @@ webpage\footnote{\url{https://fits.gsfc.nasa.gov/fits_samples.html}}. Just as another basic reporting of measurements on this dataset within the paper without using numbers in the \LaTeX{} source, the mean is $\deletemewfpctwomean$ and the median is $\deletemewfpctwomedian$. The -skewness in the histogram of Figure \ref{deleteme-wfpc2}(b) explains this -difference between the mean and median. Also, the value of quantile -$\deletemewfpcquantile$ (set in the pipeline configuration file -\texttt{delete-me-wfpc2-quant.mk}) is $\deletemewfpctwoquantile$. The -dataset was prepared for demonstration here with Gnuastro's -\textsf{Convert\-Type} program and the histogram and basic statstics were -generated with Gnuastro's \textsf{Statistics} program. +skewness in the histogram of Figure \ref{delete-me-demo}(b) explains this +difference between the mean and median. The dataset was prepared for +demonstration here with Gnuastro's \textsf{Convert\-Type} program and the +histogram and basic statstics were generated with Gnuastro's +\textsf{Statistics} program. {\small PGFP}lots\footnote{\url{https://ctan.org/pkg/pgfplots}} is a great tool to build the plots within \LaTeX{} and removes the necessity to add @@ -156,9 +154,9 @@ new co-authors (who don't want to be distracted by these issues in their first time reading). \begin{figure}[t] - \includetikz{delete-me-wfpc2} + \includetikz{delete-me-demo} - \captionof{figure}{\label{deleteme-wfpc2} (a) An example image of the + \captionof{figure}{\label{delete-me-demo} (a) An example image of the Wide-Field Planetary Camera 2, on board the Hubble Space Telescope from 1993 to 2009. This is one of the sample images from the FITS standard webpage, kept as examples for this file format. (b) Histogram of pixel diff --git a/reproduce/config/pipeline/delete-me-wfpc2-quant.mk b/reproduce/config/pipeline/delete-me-wfpc2-quant.mk deleted file mode 100644 index 2ff7456..0000000 --- a/reproduce/config/pipeline/delete-me-wfpc2-quant.mk +++ /dev/null @@ -1,2 +0,0 @@ -# Number of samples to create -delete-me-wfpc2-quantile = 0.65 diff --git a/reproduce/config/pipeline/filters.mk b/reproduce/config/pipeline/filters.mk deleted file mode 100644 index 6fa785d..0000000 --- a/reproduce/config/pipeline/filters.mk +++ /dev/null @@ -1,25 +0,0 @@ -# `filters' are the possible different parts of the survey, for -# example filters in broad or narrow-band astronomical imaging -# datasets. Since a generic term for them (to apply other types of -# surveys/datasets) hasn't been considered yet, we'll stick with the -# `filters' name. But feel free to correct it (or propose a -# suggestion). -# -# If your dataset only has a single filter, or this concept is not -# defined for your type of input dataset, you can ignore this -# variable. -# -# The values can be any string to identify different parts of a survey -# separated by white space characters (for example `f125w f160w' or `J -# H' if you want to specify two filters). -# -# To be clean and also help in readability of the pipeline, it is good -# practice to define a separate `filter-XXXX' variable for each -# survey/dataset, even if they have overlapping filters. -# -# These `filters' are used in the initial downloading of the data and -# it is good practice (for avoiding bugs) to keep the same filter (and -# survey) names in the filenames of the intermediate/output files -# also. This will make sure that the raw input and intermediate/final -# output are exactly related. -filters-survey = a b c d e f g h i diff --git a/reproduce/src/make/delete-me.mk b/reproduce/src/make/delete-me.mk index 9227fde..3f54947 100644 --- a/reproduce/src/make/delete-me.mk +++ b/reproduce/src/make/delete-me.mk @@ -47,10 +47,10 @@ $(dm): $(pconfdir)/delete-me-num.mk | $(dmdir) # # For an example image, we'll make a PDF copy of the WFPC II image to # display in the paper. -wfpc2dir = $(texdir)/delete-me-wfpc2 -$(wfpc2dir): | $(texdir); mkdir $@ -wfpc2 = $(wfpc2dir)/wfpc2.pdf -$(wfpc2): $(indir)/$(WFPC2IMAGE) | $(wfpc2dir) +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. @@ -67,8 +67,8 @@ $(wfpc2): $(indir)/$(WFPC2IMAGE) | $(wfpc2dir) # ------------------------ # # For an example plot, we'll show the pixel value histogram also. -wfpc2hist = $(wfpc2dir)/wfpc2-hist.txt -$(wfpc2hist): $(indir)/$(WFPC2IMAGE) | $(wfpc2dir) +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. @@ -86,11 +86,9 @@ $(wfpc2hist): $(indir)/$(WFPC2IMAGE) | $(wfpc2dir) # # This is just as a demonstration on how to get analysic configuration # parameters from variables defined in `reproduce/config/pipeline'. -wfpc2stats = $(wfpc2dir)/wfpc2-stats.txt -$(wfpc2stats): $(indir)/$(WFPC2IMAGE) $(pconfdir)/delete-me-wfpc2-quant.mk \ - | $(wfpc2dir) - aststatistics $< -h0 --mean --median \ - --quantile=$(delete-me-wfpc2-quantile) > $@ +stats = $(dddemodir)/wfpc2-stats.txt +$(stats): $(dddemodir)/%-stats.txt: $(indir)/%.fits | $(dddemodir) + aststatistics $< -h0 --mean --median > $@ @@ -103,7 +101,7 @@ $(wfpc2stats): $(indir)/$(WFPC2IMAGE) $(pconfdir)/delete-me-wfpc2-quant.mk \ # # NOTE: In LaTeX you cannot use any non-alphabetic character in a variable # name. -$(mtexdir)/delete-me.tex: $(dm) $(wfpc2) $(wfpc2hist) $(wfpc2stats) +$(mtexdir)/delete-me.tex: $(dm) $(demopdf) $(histogram) $(stats) # Write the number of random values used. echo "\newcommand{\deletemenum}{$(delete-me-num)}" > $@ @@ -125,11 +123,7 @@ $(mtexdir)/delete-me.tex: $(dm) $(wfpc2) $(wfpc2hist) $(wfpc2stats) echo "\newcommand{\deletememax}{$$v}" >> $@ # Write the statistics of the WFPC2 image as a macro. - q=$(delete-me-wfpc2-quantile) - echo "\newcommand{\deletemewfpcquantile}{$$q}" >> $@ - mean=$$(awk '{printf("%.2f", $$1)}' $(wfpc2stats)) + mean=$$(awk '{printf("%.2f", $$1)}' $(stats)) echo "\newcommand{\deletemewfpctwomean}{$$mean}" >> $@ - median=$$(awk '{printf("%.2f", $$2)}' $(wfpc2stats)) + median=$$(awk '{printf("%.2f", $$2)}' $(stats)) echo "\newcommand{\deletemewfpctwomedian}{$$median}" >> $@ - quantile=$$(awk '{printf("%.2f", $$3)}' $(wfpc2stats)) - echo "\newcommand{\deletemewfpctwoquantile}{$$quantile}" >> $@ diff --git a/reproduce/src/make/download.mk b/reproduce/src/make/download.mk index 180d2cf..332392b 100644 --- a/reproduce/src/make/download.mk +++ b/reproduce/src/make/download.mk @@ -30,12 +30,19 @@ # # The input dataset properties are defined in `$(pconfdir)/INPUTS.mk'. For # this template pipeline we only have one dataset to enable easy -# processing, so all the extra checks in this rule may seem -# redundant. +# processing, so all the extra checks in this rule may seem redundant. # -# However, in a real project, you will need more than one dataset. In that -# case, just add them to the target list and add an `elif' statement to -# define it in the recipe. +# In a real project, you will need more than one dataset. In that case, +# just add them to the target list and add an `elif' statement to define it +# in the recipe. +# +# Files in a server usually have very long names, which are mainly designed +# for helping in data-base management and being generic. Since Make uses +# file names to identify which rule to execute, and the scope of this +# research pipeline is much less than the generic survey/dataset, it is +# easier to have a simple/short name for the input dataset and work with +# that. In the first condition of the recipe below, we connect the short +# name with the raw database name of the dataset. # # Download lock file: Most systems have a single connection to the # internet, therefore downloading is inherently done in series. As a @@ -45,21 +52,22 @@ # process with a file and make sure that only one downloading event is in # progress at every moment. $(indir):; mkdir $@ -inputdatasets = $(foreach i, $(WFPC2IMAGE), $(indir)/$(i)) -$(inputdatasets): $(indir)/%: | $(indir) $(lockdir) +inputdatasets = $(foreach i, wfpc2, $(indir)/$(i).fits) +$(inputdatasets): $(indir)/%.fits: | $(indir) $(lockdir) # Set the necessary parameters for this input file. - if [ $* = $(WFPC2IMAGE) ]; then url=$(WFPC2URL); mdf=$(WFPC2MD5); + if [ $* = wfpc2 ]; then + origname=$(WFPC2IMAGE); url=$(WFPC2URL); mdf=$(WFPC2MD5); else - echo; echo; echo "Not recognized input dataset: '$*'." + echo; echo; echo "Not recognized input dataset: '$*.fits'." echo; echo; exit 1 fi # Download (or make the link to) the input dataset. - if [ -f $(INDIR)/$* ]; then - ln -s $(INDIR)/$* $@ + if [ -f $(INDIR)/$$origname ]; then + ln -s $(INDIR)/$$origname $@ else - flock $(lockdir)/download $(DOWNLOADER) $@ $$url/$* + flock $(lockdir)/download $(DOWNLOADER) $@ $$url/$$origname fi # Check the md5 sum to see if this is the proper dataset. @@ -67,7 +75,7 @@ $(inputdatasets): $(indir)/%: | $(indir) $(lockdir) if [ $$sum != $$mdf ]; then wrongname=$(dir $@)/wrong-$(notdir $@) mv $@ $$wrongname - echo; echo; echo "Wrong MD5 checksum for '$*' in $$wrongname" + echo; echo; echo "Wrong MD5 checksum for '$$origname' in $$wrongname" echo; echo; exit 1 fi diff --git a/tex/delete-me-demo.tex b/tex/delete-me-demo.tex new file mode 100644 index 0000000..65aa1c7 --- /dev/null +++ b/tex/delete-me-demo.tex @@ -0,0 +1,34 @@ +\begin{tikzpicture} + + %% The displayed WFPC2 image. + \node[anchor=south west] (img) at (0,0) + {\includegraphics[width=0.5\linewidth] + {\bdir/tex/delete-me-demo/wfpc2.pdf}}; + + %% Its label + \node[anchor=south west] at (0.45\linewidth,0.45\linewidth) + {\textcolor{white}{a}}; + + %% This histogram. + \begin{axis}[at={(0.52\linewidth,0.1\linewidth)}, + no markers, + axis on top, + xmode=normal, + ymode=normal, + yticklabels={}, + scale only axis, + xlabel=Pixel value, + width=0.5\linewidth, + height=0.412\linewidth, + enlarge y limits=false, + enlarge x limits=false, + ] + \addplot [const plot mark mid, fill=red] + table [x index=0, y index=1] + {\bdir/tex/delete-me-demo/wfpc2-hist.txt} + \closedcycle; + \end{axis} + + %% The histogram's label + \node[anchor=south west] at (0.95\linewidth,0.45\linewidth) {b}; +\end{tikzpicture} diff --git a/tex/delete-me-wfpc2.tex b/tex/delete-me-wfpc2.tex deleted file mode 100644 index 95b3105..0000000 --- a/tex/delete-me-wfpc2.tex +++ /dev/null @@ -1,34 +0,0 @@ -\begin{tikzpicture} - - %% The displayed WFPC2 image. - \node[anchor=south west] (img) at (0,0) - {\includegraphics[width=0.5\linewidth] - {\bdir/tex/delete-me-wfpc2/wfpc2.pdf}}; - - %% Its label - \node[anchor=south west] at (0.45\linewidth,0.45\linewidth) - {\textcolor{white}{a}}; - - %% This histogram. - \begin{axis}[at={(0.52\linewidth,0.1\linewidth)}, - no markers, - axis on top, - xmode=normal, - ymode=normal, - yticklabels={}, - scale only axis, - xlabel=Pixel value, - width=0.5\linewidth, - height=0.412\linewidth, - enlarge y limits=false, - enlarge x limits=false, - ] - \addplot [const plot mark mid, fill=red] - table [x index=0, y index=1] - {\bdir/tex/delete-me-wfpc2/wfpc2-hist.txt} - \closedcycle; - \end{axis} - - %% The histogram's label - \node[anchor=south west] at (0.95\linewidth,0.45\linewidth) {b}; -\end{tikzpicture} -- cgit v1.2.1