diff options
-rw-r--r-- | about.html | 112 | ||||
-rwxr-xr-x | index.html | 22 | ||||
-rw-r--r-- | tutorial.html | 135 |
3 files changed, 84 insertions, 185 deletions
@@ -212,9 +212,7 @@ command-line with the following command (you can come out of the "Info" environment by pressing <code>q</code>).</p> - <pre><code> -info make - </code></pre> + <pre><code>info make</code></pre> <p>If you aren't familiar with the Info documentation format, we strongly recommend running <code>$ info info</code> and reading along. In less than an hour, @@ -549,14 +547,12 @@ info make create and go into the conventional <code>master</code> branch to start committing in your project later.</p> - <pre><code> -git clone https://git.maneage.org/project.git <span class="comment"># Clone/copy the project and its history.</span> + <pre><code>git clone https://git.maneage.org/project.git <span class="comment"># Clone/copy the project and its history.</span> mv project my-project <span class="comment"># Change the name to your project's name.</span> cd my-project <span class="comment"># Go into the cloned directory.</span> git remote rename origin origin-maneage <span class="comment"># Rename current/only remote to "origin-maneage".</span> git checkout -b master <span class="comment"># Create and enter your own "master" branch.</span> -pwd <span class="comment"># Just to confirm where you are.</span> - </code></pre></li> +pwd <span class="comment"># Just to confirm where you are.</span></code></pre></li> <li><p><strong>Prepare to build project</strong>: The <code>./project configure</code> command of the next step will build the different software packages within the "build" directory (that you will specify). Nothing else on your system @@ -572,10 +568,8 @@ pwd <span class="comment"># Just to installed in the project build directory it will be removed. Again, don't worry, nothing will be installed outside the build directory.</p> - <pre><code> -<span class="comment"># On another terminal (go to top project source directory, last command above)</span> -./project --check-config - </code></pre></li> + <pre><code><span class="comment"># On another terminal (go to top project source directory, last command above)</span> +./project --check-config</code></pre></li> <li><p><strong>Test Maneage</strong>: Before making any changes, it is important to test it and see if everything works properly with the commands below. If there is any problem in the <code>./project configure</code> or <code>./project make</code> steps, @@ -587,11 +581,9 @@ pwd <span class="comment"># Just to Maneage for your project. But before that, clean all the extra Maneage outputs with <code>make clean</code> as shown below.</p> - <pre><code> -./project configure <span class="comment"># Build the project's software environment (can take an hour or so).</span> + <pre><code>./project configure <span class="comment"># Build the project's software environment (can take an hour or so).</span> ./project make <span class="comment"># Do the processing and build paper (just a simple demo).</span> -<span class="comment"># Open 'paper.pdf' and see if everything is ok. - </code></pre></li> +<span class="comment"># Open 'paper.pdf' and see if everything is ok.</code></pre></li> <li><p><strong>Setup the remote</strong>: You can use any <a href="https://en.wikipedia.org/wiki/Comparison_of_source_code_hosting_facilities">hosting facility</a> that supports Git to keep an online copy of your project's version @@ -614,11 +606,9 @@ pwd <span class="comment"># Just to command, you can actually check this (which local and remote branches are tracking each other).</p> - <pre><code> -git remote add origin XXXXXXXXXX <span class="comment"># Newly created repo is now called 'origin'.</span> + <pre><code>git remote add origin XXXXXXXXXX <span class="comment"># Newly created repo is now called 'origin'.</span> git push --set-upstream origin master <span class="comment"># Push 'master' branch to 'origin' (with tracking).</span> -git push origin maneage <span class="comment"># Push 'maneage' branch to 'origin' (no tracking).</span> - </code></pre></li> +git push origin maneage <span class="comment"># Push 'maneage' branch to 'origin' (no tracking).</span></code></pre></li> <li><p><strong>Title</strong>, <strong>short description</strong> and <strong>author</strong>: The title and basic information of your project's output PDF paper should be added in <code>paper.tex</code>. You should see the relevant place in the preamble (prior @@ -657,11 +647,9 @@ git push origin maneage <span class="comment"># Push 'maneage' b <code>download</code> to <code>XXXXX</code> (any temporary string, you'll fix it in the end of your project, when its complete).</p></li> <li><p>Delete all <code>delete-me*</code> files in the following directories:</p> - <pre><code> -rm tex/src/delete-me* + <pre><code>rm tex/src/delete-me* rm reproduce/analysis/make/delete-me* -rm reproduce/analysis/config/delete-me* - </code></pre></li> +rm reproduce/analysis/config/delete-me*</code></pre></li> <li><p>Disable verification of outputs by removing the <code>yes</code> from <code>reproduce/analysis/config/verify-outputs.conf</code>. Later, when you are ready to submit your paper, or publish the dataset, activate @@ -672,10 +660,8 @@ rm reproduce/analysis/config/delete-me* <li><p>Re-make the project (after a cleaning) to see if you haven't introduced any errors.</p> - <pre><code> -./project make clean -./project make - </code></pre></li> + <pre><code>./project make clean +./project make</code></pre></li> </ul></li> <li><p><strong>Don't merge some files in future updates</strong>: As described below, you can later update your infra-structure (for example to fix bugs) by @@ -694,15 +680,13 @@ rm reproduce/analysis/config/delete-me* other change in that file. Also, don't add core Maneage Makefiles, otherwise Maneage can break on the next run.</p> - <pre><code> -echo "paper.tex merge=ours" > .gitattributes + <pre><code>echo "paper.tex merge=ours" > .gitattributes echo "tex/src/delete-me.mk merge=ours" >> .gitattributes echo "tex/src/delete-me-demo.mk merge=ours" >> .gitattributes echo "reproduce/analysis/make/delete-me.mk merge=ours" >> .gitattributes echo "reproduce/software/config/TARGETS.conf merge=ours" >> .gitattributes echo "reproduce/analysis/config/delete-me-num.conf merge=ours" >> .gitattributes -git add .gitattributes - </code></pre></li> +git add .gitattributes</code></pre></li> <li><p><strong>Copyright and License notice</strong>: It is necessary that <em>all</em> the "copyright-able" files in your project (those larger than 10 lines) have a copyright and license notice. Please take a moment to look at @@ -720,10 +704,8 @@ git add .gitattributes <code>tex/src/preamble-header.tex</code>, <code>reproduce/analysis/make/top-make.mk</code>, and generally, all the files you modified in the previous step.</p> - <pre><code> -Copyright (C) 2018-2020 Existing Name <existing@email.address> -Copyright (C) 2020 YOUR NAME <YOUR@EMAIL.ADDRESS> - </code></pre></li> + <pre><code>Copyright (C) 2018-2020 Existing Name <existing@email.address> +Copyright (C) 2020 YOUR NAME <YOUR@EMAIL.ADDRESS></code></pre></li> <li><p><strong>Configure Git for fist time</strong>: If this is the first time you are running Git on this system, then you have to configure it with some basic information in order to have essential information in the commit @@ -732,11 +714,9 @@ Copyright (C) 2020 YOUR NAME <YOUR@EMAIL.ADDRESS> can also specify your favorite text editor for making the commit (<code>emacs</code>, <code>vim</code>, <code>nano</code>, and etc.).</p> - <pre><code> -git config --global user.name "YourName YourSurname" + <pre><code>git config --global user.name "YourName YourSurname" git config --global user.email your-email@example.com -git config --global core.editor nano - </code></pre></li> +git config --global core.editor nano</code></pre></li> <li><p><strong>Your first commit</strong>: You have already made some small and basic changes in the steps above and you are in your project's <code>master</code> branch. So, you can officially make your first commit in your @@ -745,16 +725,14 @@ git config --global core.editor nano always re-build the system before a commit to be sure it works as expected.</p> - <pre><code> -git status <span class="comment"># See which files you have changed.</span> + <pre><code>git status <span class="comment"># See which files you have changed.</span> git diff <span class="comment"># Check the lines you have added/changed.</span> ./project make <span class="comment"># Make sure everything builds successfully.</span> git add -u <span class="comment"># Put all tracked changes in staging area.</span> git status <span class="comment"># Make sure everything is fine.</span> git diff --cached <span class="comment"># Confirm all the changes that will be committed.</span> git commit <span class="comment"># Your first commit: put a good description!</span> -git push <span class="comment"># Push your commit to your remote.</span> - </code></pre></li> +git push <span class="comment"># Push your commit to your remote.</span></code></pre></li> <li><p><strong>Start your exciting research</strong>: You are now ready to add flesh and blood to this raw skeleton by further modifying and adding your exciting research steps. You can use the "published works" section in @@ -798,9 +776,7 @@ git push <span class="comment"># Push your commit to your remo dataset with the command below and replace it with your input's dataset.</p> - <pre><code> -grep -ir wfpc2 ./* - </code></pre></li> + <pre><code>grep -ir wfpc2 ./*</code></pre></li> <li><p><strong><code>README.md</code></strong>: Correct all the <code>XXXXX</code> place holders (name of your project, your own name, address of your project's online/remote repository, link to download dependencies and etc). Generally, read @@ -861,9 +837,7 @@ grep -ir wfpc2 ./* attempt, the <code>./project make</code> script should be run with the <code>--prepare-redo</code> option, or you can delete the special file above.</p> - <pre><code> -./project make --prepare-redo - </code></pre></li> + <pre><code>./project make --prepare-redo</code></pre></li> <li><p><strong>Pre-publication</strong>: add notice on reproducibility**: Add a notice somewhere prominent in the first page within your paper, informing the reader that your research is fully reproducible. For example in the @@ -981,9 +955,7 @@ grep -ir wfpc2 ./* <a href="https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html">here</a>. If you use GNU Make, you can also see this page on your command-line:</p> - <pre><code> -info make "automatic variables" - </code></pre></li> + <pre><code>info make "automatic variables"</code></pre></li> <li><p><em>Debug</em>: Since Make doesn't follow the common top-down paradigm, it can be a little hard to get accustomed to why you get an error or un-expected behavior. In such cases, run Make with the <code>-d</code> @@ -1004,15 +976,13 @@ info make "automatic variables" <code>large2.fits</code> and delete <code>large1.fits</code> in the same rule (when its no longer needed). We can later do the same with <code>large2.fits</code> when it is no longer needed and so on. - <pre><code> -large1.fits.txt: input.fits + <pre><code>large1.fits.txt: input.fits astarithmetic $< 2 + --output=$(subst .txt,,$@) echo "done" > $@ large2.fits.txt: large1.fits.txt astarithmetic $(subst .txt,,$<) 2 - --output=$(subst .txt,,$@) rm $(subst .txt,,$<) -echo "done" > $@ - </code></pre> +echo "done" > $@</code></pre> A more advanced Make programmer will use Make's <a href="https://www.gnu.org/software/make/manual/html_node/Call-Function.html">call function</a> to define a wrapper in <code>reproduce/analysis/make/initialize.mk</code>. This wrapper will replace <code>$(subst .txt,,XXXXX)</code>. Therefore, it will be @@ -1031,8 +1001,7 @@ echo "done" > $@ deletion. For example, see the minimal working example Makefile below (which you can actually put in a <code>Makefile</code> and run if you have an <code>input.fits</code> in the same directory, and Gnuastro is installed). - <pre><code> -.ONESHELL: + <pre><code>.ONESHELL: .SHELLFLAGS = -ec all: mean-std.txt shm-maneage := /dev/shm/$(shell whoami)-maneage-XXXXXXXXXX @@ -1049,8 +1018,7 @@ echo "$$out" > $@ mean-std.txt: large2.txt input=$$(cat $<) aststatistics $$input.fits --mean --std > $@ -rm $$input.fits $$input - </code></pre> +rm $$input.fits $$input</code></pre> The important point here is that the temporary name template (<code>shm-maneage</code>) has no suffix. So you can add the suffix corresponding to your desired format afterwards (for example @@ -1117,14 +1085,12 @@ rm $$input.fits $$input <strong>conflicts</strong> which might happen in the merge (updated settings that you have customized in Maneage).</p> - <pre><code> -git checkout maneage + <pre><code>git checkout maneage git pull <span class="comment"># Get recent work in Maneage</span> git log XXXXXX..XXXXXX --reverse <span class="comment"># Inspect new work (replace XXXXXXs with hashs mentioned in output of previous command).</span> git log --oneline --graph --decorate --all <span class="comment"># General view of branches.</span> git checkout master <span class="comment"># Go to your top working branch.</span> -git merge maneage <span class="comment"># Import all the work into master.</span> - </code></pre></li> +git merge maneage <span class="comment"># Import all the work into master.</span></code></pre></li> <li><p><em>Adding Maneage to a fork of your project</em>: As you and your colleagues continue your project, it will be necessary to have separate forks/clones of it. But when you clone your own project on a @@ -1135,11 +1101,9 @@ git merge maneage <span class="comment"># Import all the work below will setup the <code>origin-maneage</code> remote, and a local <code>maneage</code> branch to track it, on the new clone.</p> - <pre><code> -git remote add origin-maneage https://git.maneage.org/project.git + <pre><code>git remote add origin-maneage https://git.maneage.org/project.git git fetch origin-maneage -git checkout -b maneage --track origin-maneage/maneage - </code></pre></li> +git checkout -b maneage --track origin-maneage/maneage</code></pre></li> <li><p><em>Commit message</em>: The commit message is a very important and useful aspect of version control. To make the commit message useful for others (or yourself, one year later), it is good to follow a @@ -1197,18 +1161,14 @@ git checkout -b maneage --track origin-maneage/maneage project):</li> </ul> - <pre><code> -git bundle create my-project-git.bundle --all - </code></pre> + <pre><code>git bundle create my-project-git.bundle --all</code></pre> <ul> <li>You can easily upload <code>my-project-git.bundle</code> anywhere. Later, if you need to un-bundle it, you can use the following command.</li> </ul> - <p><p><pre><code> -git clone my-project-git.bundle - </code></pre></li> + <p><p><pre><code>git clone my-project-git.bundle</code></pre></li> </ul></p></li> </ul></p> @@ -1241,9 +1201,7 @@ git clone my-project-git.bundle architecture) and the standard program name. For example (from the Nix webpage):</p> - <pre><code> -/nix/store/b6gvzjyb2pg0kjfwrjmg1vfhh54ad73z-firefox-33.1/ - </code></pre> + <pre><code>/nix/store/b6gvzjyb2pg0kjfwrjmg1vfhh54ad73z-firefox-33.1/</code></pre> <p>The important thing is that the "store" is <em>not</em> in the project's search path. After the complete installation of the software, symbolic links are @@ -82,19 +82,15 @@ <section> <h3>Start building your project in Maneage</h3> <p>To start a new project, simply run these commands to clone it from its <a href="http://git.maneage.org/project.git">Git repository</a>. - <pre><code> -git clone https://git.maneage.org/project.git <span class="comment"># Clone Maneage, default branch `maneage'.</span> + <pre><code>git clone https://git.maneage.org/project.git <span class="comment"># Clone Maneage, default branch `maneage'.</span> mv project my-project && cd my-project <span class="comment"># Set custom name and enter directory.</span> git remote rename origin origin-maneage <span class="comment"># Rename remote server to use `origin' later.</span> -git checkout -b master <span class="comment"># Make new `master' branch, start customizing.</span> - </code></pre> +git checkout -b master <span class="comment"># Make new `master' branch, start customizing.</span></code></pre> </p> <p>You are now ready to configure and make the raw template with the commands below. If they are successful, you can start customizing it. - <pre><code> -./project configure <span class="comment"># Build all necessary software from source.</span> -./project make <span class="comment"># Do the analysis (download data, run software on data, build PDF).</span> - </code></pre> + <pre><code>./project configure <span class="comment"># Build all necessary software from source.</span> +./project make <span class="comment"># Do the analysis (download data, run software on data, build PDF).</span></code></pre> </p> <p>See the <a href="https://gitlab.com/maneage/project/-/blob/maneage/README-hacking.md#customization-checklist">Customization Checklist</a> in the cloned <code>README-hacking.md</code> file for the next steps to start customizing Maneage for your project. </p> @@ -108,10 +104,8 @@ git checkout -b master <span class="comment"># Make n </p> <ol> <li>Go to the <code>maneage</code> branch and create a new branch from there like below: - <pre><code> -git checkout maneage -git branch -b my-fix - </code></pre> + <pre><code>git checkout maneage +git branch -b my-fix</code></pre> </li> <li>Commit your fix over this new branch.</li> <li>Build a new project on your favorite Git repository (GitLab, BitBucket, or GitHub for example) and assign it to a new Git remote in your project. @@ -119,9 +113,7 @@ git branch -b my-fix You only need to do this once and keep this for future fixes. </li> <li>Push your branch to that remote: - <pre><code> -git push my-remote my-fix - </code></pre> + <pre><code>git push my-remote my-fix</code></pre> </li> <li>Submit a link to your fork and the corresponding branch <a href="http://savannah.nongnu.org/support/?func=additem&group=reproduce">on Savannah</a>. If you are <a href="https://savannah.nongnu.org/account/register.php">registered on Savannah</a>, you can also submit it as <a href="https://savannah.nongnu.org/bugs/?func=additem&group=reproduce">a bug</a> or <a href="https://savannah.nongnu.org/task/?func=additem&group=reproduce">a task</a>. diff --git a/tutorial.html b/tutorial.html index 1439f10..aaef7c7 100644 --- a/tutorial.html +++ b/tutorial.html @@ -122,20 +122,16 @@ <code>reproduce/software/config/installation/TARGETS.mk</code> and add to the <code>top-level-python</code> line, the word <code>matplotlib</code>.</p> - <pre><code> -# Python libraries/modules. - top-level-python = astropy matplotlib - </code></pre> + <pre><code># Python libraries/modules. + top-level-python = astropy matplotlib</code></pre> <p>After that, run the configure step again with the option <code>-e</code> to continue using the same configuration options given before (input and build directories). Also, run the prepare and make steps:</p> - <pre><code> -./project configure -e + <pre><code>./project configure -e ./project prepare -./project make - </code></pre> +./project make</code></pre> <p>Open 'paper.pdf' and see if everything is fine. Note that now, <code>Matplotlib</code> is appearing in the software appendix at the end of the document.</p> @@ -151,14 +147,12 @@ Finally, as this is the very first commit of the project, tag this as the zero-th version.</p> - <pre><code> -git status # See which files have been changed. + <pre><code>git status # See which files have been changed. git diff # See the lines you have modified. git add -u # Put all tracked changes in staging area. git status # Make sure everything is fine. git commit # Your first commit, add a nice description. -git tag -a v0.0 # Tag this as the zero-th version of your project. - </code></pre> +git tag -a v0.0 # Tag this as the zero-th version of your project.</code></pre> <p>Now, have a look at the <code>Git</code> history of the project. Note that the local master branch is one commit above than the remote origin/master branch. @@ -166,11 +160,9 @@ git tag -a v0.0 # Tag this as the zero-th version of your project. with the next commands. Since you had setup your <code>master</code> branch to follow <code>origin/master</code>, you can just use <code>git push</code>.</p> - <pre><code> -git log --oneline --decorate --all --graph # Have a look at the Git history. + <pre><code>git log --oneline --decorate --all --graph # Have a look at the Git history. git push # Push the commit to the remote/origin. -git push --tags # Push all tags to the remote/origin. - </code></pre> +git push --tags # Push all tags to the remote/origin.</code></pre> <p>Now it is time to start including your own scripts to download and make the analysis of the data. It is important to bear in mind that the goal of this @@ -205,9 +197,7 @@ git push --tags # Push all tags to the remote/origi into the <code>bash</code> directory. Since there is any <code>python</code> directory, create it with the following command.</p> - <pre><code> -mkdir reproduce/analysis/python - </code></pre> + <pre><code>mkdir reproduce/analysis/python</code></pre> <p>After that, you need the Python script itself. The code is very simple: it will take an input file containing two columns (year and population), the @@ -217,8 +207,7 @@ mkdir reproduce/analysis/python into the directory generated in the above step (<code>reproduce/analysis/python</code>).</p> - <pre><code> -<span class="comment"># Make a linear fit of an input data set</span> + <pre><code><span class="comment"># Make a linear fit of an input data set</span> <span class="comment"># This Python script makes a linear fitting of a data consisting in time and</span> <span class="comment"># population. It generates a figure in which the original data and the</span> <span class="comment"># fitted curve is plotted. Finally, it saves the fitting parameters.</span> @@ -299,9 +288,7 @@ np.savetxt(ofile, params, fmt='%.3f') <p>As it can be seen, this Python script (<code>linear-fit.py</code>) is designed to be invoked from the command line in the following way.</p> - <pre><code> -python /path/to/linear-fit.py /path/to/input.dat /path/to/output.dat /path/to/figure.pdf - </code></pre> + <pre><code>python /path/to/linear-fit.py /path/to/input.dat /path/to/output.dat /path/to/figure.pdf</code></pre> <p><code>/path/to/input.dat</code> is the input data file, <code>/path/to/output.dat</code> is the output data file (with the fitted parameters), and <code>/path/to/figure.pdf</code> is @@ -315,21 +302,17 @@ python /path/to/linear-fit.py /path/to/input.dat /path/to/output.dat /path/to/fi information, comments or clarify any step. After that, add the files and commit the work. Finally, push the commit to the remote/origin.</p> - <pre><code> -git status # See which files you have changed. + <pre><code>git status # See which files you have changed. git diff # See the lines you have added/changed. git add reproduce/analysis/python/linear-fit.py # Put all tracked changes in staging area. git commit # Commit, add a nice descriptions. -git push # Push the commit to the remote/origin. - </code></pre> +git push # Push the commit to the remote/origin.</code></pre> <p>Check that everything is fine having a look at the <code>Git</code> history of the project. Note that the <code>master</code> branch has been increased in one commit, while the <code>template</code> branch is behind.</p> - <pre><code> -git log --oneline --decorate --all --graph # See the `Git` history. - </code></pre> + <pre><code>git log --oneline --decorate --all --graph # See the `Git` history.</code></pre> <p><strong>In short</strong>: in this section you have included a <code>Python</code> script that will be used for making the linear fitting.</p> @@ -355,8 +338,7 @@ git log --oneline --decorate --all --graph # See the `Git` history. analysis. Save this Makefile in the dedicated directory (<code>reproduce/analysis/make</code>) with the name <code>getdata-analysis.mk</code>. In that Makefile, paste the following code.</p> - <pre><code> -<span class="comment"># Download data for the tutorial</span> + <pre><code><span class="comment"># Download data for the tutorial</span> <span class="comment">#</span> <span class="comment"># In this Makefile, data for the tutorial is downloaded.</span> <span class="comment">#</span> @@ -384,8 +366,7 @@ wget http://akhlaghi.org/data/template-tutorial/ESP.dat -O $@ <span class="comment"># It is very important to mention the address where the data were</span> <span class="comment"># downloaded in the final report.</span> $(mtexdir)/getdata-analysis.tex: $(pop-data) | $(mtexdir) -echo "\newcommand{\popurl}{http://akhlaghi.org/data/template-tutorial}" > $@ - </code></pre> +echo "\newcommand{\popurl}{http://akhlaghi.org/data/template-tutorial}" > $@</code></pre> <p>Have a look at this Makefile and see the different parts. The first line is a descriptive title. Below, include your name, contact email, and finally, the copyright. Please, take your time in order to add all relevant @@ -396,10 +377,8 @@ echo "\newcommand{\popurl}{http://akhlaghi.org/data/template-tutorial}" > $@ different parts. Then, you have the Make rule to download the data. Remember the general structure of a Make rule:</p> - <pre><code> -TARGETS: PREREQUISITES -RECIPE - </code></pre> + <pre><code>TARGETS: PREREQUISITES +RECIPE</code></pre> <p>In a rule, it is said how to construct the <code>TARGETS</code> from the <code>PREREQUISITES</code>, following the <code>RECIPE</code>. <strong>Note that the white space at the @@ -408,10 +387,8 @@ RECIPE <p>Now you can see this structure in our particular case:</p> - <pre><code> -(pop-data): | $(indir) -wget http://akhlaghi.org/data/template-tutorial/ESP.dat -O $@ - </code></pre> + <pre><code>(pop-data): | $(indir) +wget http://akhlaghi.org/data/template-tutorial/ESP.dat -O $@</code></pre> <p>Here we have:</p> @@ -439,10 +416,8 @@ wget http://akhlaghi.org/data/template-tutorial/ESP.dat -O $@ consequence, they will be <code>TeX</code> macros in which relevant information to be included into the final paper are saved . Here, you are saving the <code>URL</code>.</p> - <pre><code> -(mtexdir)/getdata-analysis.tex: $(pop-data) | $(mtexdir) -echo "\\newcommand{\\popurl}{http://akhlaghi.org/data/template-tutorial}" > $@ - </code></pre> + <pre><code>(mtexdir)/getdata-analysis.tex: $(pop-data) | $(mtexdir) +echo "\\newcommand{\\popurl}{http://akhlaghi.org/data/template-tutorial}" > $@</code></pre> <p>In this final rule we have:</p> @@ -469,13 +444,11 @@ echo "\\newcommand{\\popurl}{http://akhlaghi.org/data/template-tutorial}" > $ <code>reproduce/analysis/make/top-make.mk</code> Makefile. There it is defined which Makefiles have to be executed. You have to end up having:</p> - <pre><code> -makesrc = initialize \ + <pre><code>makesrc = initialize \ download \ getdata-analyse \ delete-me \ -paper - </code></pre> +paper</code></pre> <p>As allways, read carefully all comments and information in order to know what is going ong. Also, add your own comments and information in order to @@ -483,9 +456,7 @@ paper fine, now the project is ready to download the data in the make step. Try it!</p> - <pre><code> -./project make - </code></pre> + <pre><code>./project make</code></pre> <p>Hopefully, it will download and save the file into the folder called <code>inputs</code> under the <code>build-directory</code>. Check that it is there, and also have @@ -528,34 +499,26 @@ paper generated for downloading the data. But, before this, define the directory in which the target is going to be saved.</p> - <pre><code> -odir = $(BDIR)/fit-parameters - </code></pre> + <pre><code>odir = $(BDIR)/fit-parameters</code></pre> <p>This is a folder under the <code>build-directory</code> called <code>fit-parameters</code>. After that, define the target: a plain text file in which the linear fit parameters are saved (by the Python script). Put it into the previously defined directory. As the data is from Spain, name it <code>ESP.txt</code>.</p> - <pre><code> -param-file = $(odir)/ESP.txt - </code></pre> + <pre><code>param-file = $(odir)/ESP.txt</code></pre> <p>Now, include a rule to construct the output directory <code>odir</code>. This is necessary because this directory is needed for saving the file <code>ESP.txt</code>.</p> - <pre><code> -(odir): -mkdir $@ - </code></pre> + <pre><code>(odir): +mkdir $@</code></pre> <p>With all the previous definitions, now it is possible to set the rule for making the analysis:</p> - <pre><code> -(param-file): $(indir)/ESP.dat | $(odir) -python reproduce/analysis/python/linear-fit.py $< $@ $(odir)/ESP.pdf - </code></pre> + <pre><code>(param-file): $(indir)/ESP.dat | $(odir) +python reproduce/analysis/python/linear-fit.py $< $@ $(odir)/ESP.pdf</code></pre> <p>In this rule you have:</p> @@ -585,37 +548,29 @@ python reproduce/analysis/python/linear-fit.py $< $@ $(odir)/ESP.pdf rule, define a couple of bash variables (<code>a</code> and <code>b</code>) that are the fitted parameters extracted from the prerequisite. For <code>a</code>:</p> - <pre><code> -a=$$(cat $< | awk 'NR==1{print $1}') - </code></pre> + <pre><code>a=$$(cat $< | awk 'NR==1{print $1}')</code></pre> <p>Similarly, for obtaining the parameter <code>b</code> (which is in the second row):</p> - <pre><code> -b=$$(cat $< | awk 'NR==2{print $1}') - </code></pre> + <pre><code>b=$$(cat $< | awk 'NR==2{print $1}')</code></pre> <p>Then you have to specify the new <code>TeX</code> commands for these two parameters, just write them as it was done before for the <code>URL</code>:</p> - <pre><code> -echo "\newcommand{\afitparam}{$$a}" >> $@ -echo "\newcommand{\bfitparam}{$$b}" >> $@ - </code></pre> + <pre><code>echo "\newcommand{\afitparam}{$$a}" >> $@ +echo "\newcommand{\bfitparam}{$$b}" >> $@</code></pre> <p>So, at the end you will have the final rule like this:</p> <code>(mtexdir)/getdata-analysis.tex: $(param-file) | $(mtexdir)</code> - <pre><code> -echo "\\newcommand{\\popurl}{http://akhlaghi.org/data/template-tutorial}" > $@ + <pre><code>echo "\\newcommand{\\popurl}{http://akhlaghi.org/data/template-tutorial}" > $@ a=$$(cat $< | awk 'NR==1{print $1}') b=$$(cat $< | awk 'NR==2{print $1}') echo "\newcommand{\afitparam}{$$a}" >> $@ -echo "\newcommand{\bfitparam}{$$b}" >> $@ - </code></pre> +echo "\newcommand{\bfitparam}{$$b}" >> $@</code></pre> <p><strong>Important notes: you have to use two <code>$</code> in order to use the bash <code>$</code> character inside of a Make rule. Also, note that you have to put <code>>></code> in @@ -626,8 +581,7 @@ echo "\newcommand{\bfitparam}{$$b}" >> $@ <p>With all the above modifications, you are ready to obtain the fitting parameters. If you add the necessary comments and information, the final Makefile would look similar to:</p> -<pre><code> -<span class="comment"># Download data and linear fitting for the tutorial</span> +<pre><code><span class="comment"># Download data and linear fitting for the tutorial</span> <span class="comment"># In this Makefile, data for the tutorial is downloaded. Then, a Python</span> <span class="comment"># script is used to make a linear fitting. Finally, fitted parameters as</span> <span class="comment"># well as the URL is saved into a TeX macro.</span> @@ -677,17 +631,14 @@ a=$$(cat $< | awk 'NR==1{print $1}') b=$$(cat $< | awk 'NR==2{print $1}') echo "\newcommand{\afitparam}{$$a}" >> $@ -echo "\newcommand{\bfitparam}{$$b}" >> $@ - </code></pre> +echo "\newcommand{\bfitparam}{$$b}" >> $@</code></pre> <p>Have look at this Makefile and note that it is what it has been described above. Take your time for making useful comments and modifying whatever you think it is necessary. If everything is fine, now the project is ready to download the data <strong>and</strong> make the linear fitting. Try it!</p> - <pre><code> -./project make - </code></pre> + <pre><code>./project make</code></pre> <p>Hopefully, now you will have the fitted parameters into the <code>build-directory/fit-parameters/ESP.txt</code> file, and the figure in the same @@ -721,11 +672,9 @@ echo "\newcommand{\bfitparam}{$$b}" >> $@ and add the following paragraph just at the beginning of the abstract section.</p> - <pre><code> -By following the steps described in the tutorial, I have been able to obtain this reproducible paper! + <pre><code>By following the steps described in the tutorial, I have been able to obtain this reproducible paper! The project is very simple and it consists in download a file (from \popurl), and make an easy linear fit using a Python script. -The linear fitting is $y=a*x+b$, with the following parameters: $a=\afitparam$ and $b=\bfitparam$ - </code></pre> +The linear fitting is $y=a*x+b$, with the following parameters: $a=\afitparam$ and $b=\bfitparam$</code></pre> <p>As you can see, the <code>TeX</code> definitions done before in the Makefiles, are now included into the paper: <code>\popurl</code>, <code>\afitparam</code>, and <code>\bfitparam</code>. If you |