Skip to content

Commit

Permalink
Merge pull request #587 from effigies/report/version
Browse files Browse the repository at this point in the history
ENH: Add version and timestamp
  • Loading branch information
effigies authored Jul 18, 2017
2 parents f421c9e + 265d085 commit 4ce320a
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Next release
============

With thanks to Yaroslav Halchenko for contributions.

* [ENH] High-pass filter time series prior to CompCor (#577)
* [ENH] Validate and minimally conform BOLD images (#581)
* [FIX] Bug that prevented PE direction estimation (#586)
* [DOC] Log version/time in report (#587)

0.5.2 (30th of June 2017)
=========================
Expand Down
2 changes: 1 addition & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ dependencies:
- svgutils
- nitime
- nilearn
- git+https://github.com/poldracklab/niworkflows.git@2de9c245b11f5328743c73d3ec80a969a20c6e5c#egg=niworkflows
- niworkflows>=0.1.4
2 changes: 1 addition & 1 deletion fmriprep/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
'grabbit',
'pybids>=0.2.1',
'nitime',
'niworkflows>=0.1.3',
'niworkflows>=0.1.4',
'statsmodels',
'nipype',
'seaborn',
Expand Down
13 changes: 12 additions & 1 deletion fmriprep/viz/report.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ body {
{% for run_report in sub_report.run_reports %}
<li><a class="dropdown-item" href="#{{run_report.name}}">{{run_report.title}}</a></li>
{% endfor %}
<li><a class="dropdown-item" href="#errors">Errors</a></li>
</ul>
</li>
{% else %}
<li><a href="#{{sub_report.name}}">{{ sub_report.name }}</a></li>
{% endif %}
<li><a class="dropdown-item" href="#about">About</a></li>
<li><a class="dropdown-item" href="#errors">Errors</a></li>
{% endfor %}
</ul>
<div>
Expand Down Expand Up @@ -91,6 +92,14 @@ body {
</div>
{% endfor %}

<div id="about">
<h1 class="sub-report-title">About</h1>
<ul>
<li>FMRIPREP version: {{ version }}</li>
<li>Report generated: {{ date }}</li>
</ul>
</div>

<div id="errors">
<h1 class="sub-report-title">Errors</h1>
<ul>
Expand All @@ -113,6 +122,8 @@ body {
</div>
</div>
</li>
{% else %}
<li>No errors to report!</li>
{% endfor %}
</ul>
</div>
Expand Down
7 changes: 6 additions & 1 deletion fmriprep/viz/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import json
import re
import os
import time

import jinja2
from niworkflows.nipype.utils.filemanip import loadcrash
from pkg_resources import resource_filename as pkgrf

from .. import __version__


class Element(object):
def __init__(self, name, file_pattern, title=None, description=None, raw=False):
Expand Down Expand Up @@ -153,7 +156,9 @@ def generate_report(self):
trim_blocks=True, lstrip_blocks=True
)
report_tpl = env.get_template('viz/report.tpl')
report_render = report_tpl.render(sub_reports=self.sub_reports, errors=self.errors)
report_render = report_tpl.render(sub_reports=self.sub_reports, errors=self.errors,
date=time.strftime("%Y-%m-%d %H:%M:%S %z"),
version=__version__)
with open(os.path.join(self.out_dir, "fmriprep", self.out_filename), 'w') as fp:
fp.write(report_render)
return len(self.errors)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
git+https://github.com/poldracklab/niworkflows.git@2de9c245b11f5328743c73d3ec80a969a20c6e5c#egg=niworkflows
niworkflows>=0.1.4

0 comments on commit 4ce320a

Please sign in to comment.