Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Commit f53075d

Browse files
authored
Merge pull request #295 from ndawe/branch_spec
[MRG] Crop subarrays to fixed length and impute default values
2 parents c2fa643 + 0086669 commit f53075d

32 files changed

+16065
-11913
lines changed

.coveragerc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ omit =
88
*/root/*
99
*/root_numpy/extern/*
1010
*/root_numpy/setup_utils.py
11-
*/setup.py
11+
*/tests/*
1212
*/tests.py
13+
*/setup.py
1314
[report]
1415
exclude_lines =
1516
# Enable the standard pragma

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ endif
2121

2222
all: clean cython inplace test
2323

24+
clean-examples:
25+
@find examples -name "*.root" -exec rm {} \;
26+
2427
clean-pyc:
2528
@find . -name "*.pyc" -exec rm {} \;
2629

@@ -33,7 +36,7 @@ clean-build:
3336
clean-html:
3437
@find root_numpy/src -name "*.html" -exec rm {} \;
3538

36-
clean: clean-build clean-pyc clean-so
39+
clean: clean-examples clean-build clean-pyc clean-so
3740

3841
.SECONDEXPANSION:
3942
%.cpp: %.pyx $$(filter-out $$@,$$(wildcard $$(@D)/*))

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
# General information about the project.
5858
project = u'root_numpy'
59-
copyright = u'%s, rootpy developers and contributors' % now.year
59+
copyright = u'%s, <a target="_blank" href="https://github.com/rootpy/root_numpy/graphs/contributors">root_numpy developers and contributors</a>' % now.year
6060

6161
# The version info for the project you're documenting, acts as replacement for
6262
# |version| and |release|, also used in various other places throughout the

docs/examples.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ root_numpy
1717
start
1818
faq
1919
reference/index
20-
examples
20+
auto_examples/index

docs/install.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ be found, the installation aborts.
1717

1818
root_numpy has been tested with:
1919

20-
* ROOT 5.32, 5.34, 6.04, 6.06
21-
* NumPy 1.6, 1.7, 1.8, 1.9, 1.10
20+
* ROOT 5.32, 5.34, 6.04, 6.06, 6.09
21+
* NumPy 1.6, 1.7, 1.8, 1.9, 1.10, 1.11
2222
* Python 2.6, 2.7, 3.4, 3.5
2323
* GNU/Linux, Mac OS
2424

docs/sphinxext/gen_rst.py

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def extract_docstring(filename):
117117
first_par = paragraphs[0]
118118
break
119119
end_row = erow + 1 + start_row
120-
if lines and lines[end_row - 2] == 'print __doc__\n':
120+
if lines and lines[end_row - 2] == 'print(__doc__)\n':
121121
end_row += 1
122122
return docstring, first_par, end_row
123123

@@ -171,6 +171,10 @@ def generate_example_rst(app):
171171
</style>
172172
173173
.. _examples-index:
174+
175+
Examples
176+
========
177+
174178
""")
175179
# Here we don't use an os.walk, but we recurse only twice: flat is
176180
# better than nested.
@@ -191,11 +195,9 @@ def generate_dir_rst(dir, fhindex, example_dir, root_dir, plot_gallery):
191195
target_dir = root_dir
192196
src_dir = example_dir
193197
if not os.path.exists(os.path.join(src_dir, 'README.txt')):
194-
print 80 * '_'
195-
print ('Example directory %s does not have a README.txt file'
196-
% src_dir)
197-
print 'Skipping this directory'
198-
print 80 * '_'
198+
print('Example directory %s does not have a README.txt file' % src_dir)
199+
print('Skipping this directory')
200+
print(80 * '_')
199201
return
200202
fhindex.write("""
201203
@@ -212,6 +214,12 @@ def sort_key(a):
212214
if not a.startswith('plot') and a.endswith('.py'):
213215
return 'zz' + a
214216
return a
217+
218+
fhindex.write("""
219+
220+
.. toctree::
221+
222+
""")
215223
for fname in sorted(os.listdir(src_dir), key=sort_key):
216224
if fname.endswith('py'):
217225
generate_file_rst(fname, target_dir, src_dir, plot_gallery)
@@ -226,13 +234,10 @@ def sort_key(a):
226234
#else:
227235
# fhindex.write(' :target: ./%s.html\n\n' % link_name[:-3])
228236
fhindex.write("""
229-
230-
.. toctree::
231-
232237
%s/%s
233-
234238
""" % (dir, fname[:-3]))
235239
fhindex.write("""
240+
236241
.. raw:: html
237242
238243
<div style="clear: both"></div>
@@ -295,7 +300,7 @@ def generate_file_rst(fname, target_dir, src_dir, plot_gallery):
295300
os.stat(first_image_file).st_mtime <=
296301
os.stat(src_file).st_mtime):
297302
# We need to execute the code
298-
print 'plotting %s' % fname
303+
print('plotting %s' % fname)
299304
t0 = time()
300305
import matplotlib.pyplot as plt
301306
plt.close('all')
@@ -341,20 +346,26 @@ def generate_file_rst(fname, target_dir, src_dir, plot_gallery):
341346
plt.savefig(image_path % fig_num)
342347
figure_list.append(image_fname % fig_num)
343348
for canvas in ROOT.gROOT.GetListOfCanvases():
344-
canvas.SaveAs(root_image_path % root_fig_num)
345-
canvas.Close()
346-
figure_list.append(root_image_fname % root_fig_num)
347-
root_fig_num += 1
349+
maybe_root_filename = os.path.join(os.path.dirname(src_file), canvas.name)
350+
if os.path.isfile(maybe_root_filename):
351+
os.rename(maybe_root_filename, os.path.join(image_dir, canvas.name))
352+
figure_list.append(canvas.name)
353+
canvas.Close()
354+
else:
355+
canvas.SaveAs(root_image_path % root_fig_num)
356+
canvas.Close()
357+
figure_list.append(root_image_fname % root_fig_num)
358+
root_fig_num += 1
348359
except:
349-
print 80 * '_'
350-
print '%s is not compiling:' % fname
360+
print(80 * '_')
361+
print('%s is not compiling:' % fname)
351362
traceback.print_exc()
352-
print 80 * '_'
363+
print(80 * '_')
353364
finally:
354365
os.chdir(cwd)
355366
sys.stdout = orig_stdout
356367

357-
print " - time elapsed : %.2g sec" % time_elapsed
368+
print(" - time elapsed : %.2g sec" % time_elapsed)
358369
else:
359370
figure_list = [f[len(image_dir):]
360371
for f in glob.glob(image_path % '[1-9]')]

docs/themes/sphinx_rtd_theme/footer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
{%- if hasdoc('copyright') %}
1919
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
2020
{%- else %}
21-
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}
21+
&copy; Copyright {{ copyright }}.
2222
{%- endif %}
2323
{%- endif %}
2424

examples/README.txt

Whitespace-only changes.

examples/core/README.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.. _examples:
2+
3+
root_numpy
4+
----------

0 commit comments

Comments
 (0)