Skip to content

Commit ae3b8ea

Browse files
author
Alice Harpole
committed
Pyro now finds pyro location by looking up location of pyro.py - no longer have to set PYRO_HOME. Have reverted the docs to reflect this. Have also updated .travis.yml file to make sure examples.ipynb is tested
1 parent d031ce9 commit ae3b8ea

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ before_script:
2323

2424
script:
2525
- flake8 .
26-
- pytest -v --cov=. --cov-config .coveragerc --nbval --ignore=docs --ignore=./multigrid/variable_coeff_elliptic.ipynb --ignore=examples
26+
- pytest -v --cov=. --cov-config .coveragerc --nbval --ignore=docs --ignore=./multigrid/variable_coeff_elliptic.ipynb --ignore=examples/mesh --ignore=examples/multigrid
2727
# - travis-sphinx build
2828

2929
# after_success:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ http://python-hydro.github.io/pyro2/
7777
directory.
7878

7979
* Define the environment variable `PYRO_HOME` to point to the
80-
`pyro2/` directory
80+
`pyro2/` directory (only needed for regression testing)
8181

8282
* Build the Fortran source. In `pyro2/` type
8383

docs/source/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The following steps are needed before running pyro:
3636
./mk.sh
3737
3838
* define the environment variable ``PYRO_HOME`` to point to
39-
the ``pyro2/`` directory
39+
the ``pyro2/`` directory (only needed for regression testing)
4040

4141
.. code-block:: none
4242

examples/examples.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,14 @@
271271
" 11 1.00000 0.00000\n",
272272
"\u001b[33moutputting...\u001b[0m\n",
273273
"\u001b[33moutputting...\u001b[0m\n",
274-
"vis: 0.2423102855682373\n",
275-
"main: 0.07352924346923828\n"
274+
"vis: 0.417586088180542\n",
275+
"main: 0.15765929222106934\n"
276276
]
277277
},
278278
{
279279
"data": {
280280
"text/plain": [
281-
"<advection.simulation.Simulation at 0x7f293ebf2390>"
281+
"<advection.simulation.Simulation at 0x11e185668>"
282282
]
283283
},
284284
"execution_count": 9,
@@ -455,7 +455,7 @@
455455
],
456456
"metadata": {
457457
"kernelspec": {
458-
"display_name": "Python 3",
458+
"display_name": "Python [default]",
459459
"language": "python",
460460
"name": "python3"
461461
},

pyro.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, solver_name):
4646
if solver_name not in valid_solvers:
4747
msg.fail("ERROR: %s is not a valid solver" % solver_name)
4848

49-
os.chdir(os.environ["PYRO_HOME"])
49+
self.pyro_home = os.path.dirname(os.path.realpath(__file__)) + '/'
5050

5151
# import desired solver under "solver" namespace
5252
self.solver = importlib.import_module(solver_name)
@@ -58,8 +58,8 @@ def __init__(self, solver_name):
5858

5959
# parameter defaults
6060
self.rp = runparams.RuntimeParameters()
61-
self.rp.load_params("_defaults")
62-
self.rp.load_params(solver_name + "/_defaults")
61+
self.rp.load_params(self.pyro_home + "_defaults")
62+
self.rp.load_params(self.pyro_home + solver_name + "/_defaults")
6363

6464
self.tc = profile.TimerCollection()
6565

@@ -82,7 +82,7 @@ def initialize_problem(self, problem_name, inputs_file=None, inputs_dict=None,
8282
Other command line parameter options
8383
"""
8484

85-
problem_defaults_file = self.solver_name + \
85+
problem_defaults_file = self.pyro_home + self.solver_name + \
8686
"/problems/_" + problem_name + ".defaults"
8787

8888
# problem-specific runtime parameters
@@ -93,7 +93,7 @@ def initialize_problem(self, problem_name, inputs_file=None, inputs_dict=None,
9393
if inputs_file is not None:
9494
if not os.path.isfile(inputs_file):
9595
# check if the param file lives in the solver's problems directory
96-
inputs_file = self.solver_name + "/problems/" + inputs_file
96+
inputs_file = self.pyro_home + self.solver_name + "/problems/" + inputs_file
9797
if not os.path.isfile(inputs_file):
9898
msg.fail("ERROR: inputs file does not exist")
9999

@@ -308,7 +308,7 @@ def store_as_benchmark(self):
308308
"ERROR: unable to create the solver's tests/ directory")
309309

310310
basename = self.rp.get_param("io.basename")
311-
bench_file = self.solver_name + "/tests/" + \
311+
bench_file = self.pyro_home + self.solver_name + "/tests/" + \
312312
basename + "%4.4d" % (self.sim.n)
313313
msg.warning("storing new benchmark: {}\n".format(bench_file))
314314
self.sim.write(bench_file)

0 commit comments

Comments
 (0)