If I compile Hyperion with --enable-debug and then run the tests, there are a few failures that need to be investigated:
=================================== FAILURES ===================================
________________________ test_point_source_outside_grid ________________________
tmpdir = local('/tmp/tmp8ee8ggsh/test_point_source_outside_grid0')
def test_point_source_outside_grid(tmpdir):
dust = get_test_dust()
m = Model()
m.set_cartesian_grid([-1., 1.], [-1., 1.], [-1., 1.])
m.add_density_grid(np.array([[[1.]]]), dust)
m.set_n_photons(initial=100, imaging=0)
s = m.add_point_source()
s.position = (-1.5, 0., 0.)
s.temperature = 5000.
s.luminosity = 1.
m.write(tmpdir.join(random_id()).strpath)
log_file = tmpdir.join(random_id()).strpath
with pytest.raises(SystemExit) as exc:
m.run(tmpdir.join(random_id()).strpath, logfile=log_file)
assert exc.value.args[0] == 'An error occurred, and the run did not ' + \
'complete'
with open(log_file) as f:
log_file_contents = f.read()
print(log_file_contents)
> assert 'photon was not emitted inside a cell' in log_file_contents
E assert 'photon was not emitted inside a cell' in "At line 186 of file src/grid/grid_geometry_cartesian_3d.f90\nFortran runtime error: Index '-1' of dimension 1 of arra...place_in_cell failed - killing [place_in_cell]\nRun did not complete successfully: output file appears to be corrupt\n"
hyperion/model/tests/test_fortran.py:33: AssertionError
----------------------------- Captured stdout call -----------------------------
At line 186 of file src/grid/grid_geometry_cartesian_3d.f90
Fortran runtime error: Index '-1' of dimension 1 of array 'geo%w1' below lower bound of 1
Error termination. Backtrace:
#0 0x7f2502bd62da in ???
#1 0x7f2502bd6ec5 in ???
#2 0x7f2502bd7297 in ???
#3 0x557b8f434d21 in adjust_wall
at src/grid/grid_geometry_cartesian_3d.f90:186
#4 0x557b8f434c7d in __grid_geometry_specific_MOD_place_in_cell
at src/grid/grid_geometry_cartesian_3d.f90:255
#5 0x557b8f4590d4 in __sources_MOD_emit
at src/sources/source.f90:176
#6 0x557b8f48cc94 in __iteration_lucy_MOD_do_lucy
at src/main/iter_lucy.f90:130
#7 0x557b8f4903ae in MAIN__
at src/main/main.f90:183
#8 0x557b8f490f22 in main
at src/main/main.f90:3
------------------------------------------------------------
Hyperion v1.0.0
Started on 05 February 2019 at 14:57:40
Input: /tmp/tmp8ee8ggsh/test_point_source_outside_grid0/CnRSrkVXiI6su7bhZejmz3wHWExv1FUJ
Output: /tmp/tmp8ee8ggsh/test_point_source_outside_grid0/1HZ6zx9KJ3PWfsatgFYprRBGu2lOoyjI
------------------------------------------------------------
[main] using random seed = -124902
[dust] reading dust_001
[setup_grid_geometry] Reading cartesian grid
[grid_physics] reading density grid
[grid_physics] reading minimum_specific_energy
[grid_physics] checking energy_abs
WARNING: specific_energy below minimum allowed in some cells - resetting [update_energy_abs]
[grid_physics] updating energy_abs_tot
[sources] setting up sources
[main] starting Lucy iteration 1
[grid_physics] pre-computing jnu_var
# Photons CPU time (sec) Photons/sec
----------------------------------------------
WARNING: photon not in grid (in x direction) [find_cell]
WARNING: place_in_cell failed - killing [place_in_cell]
Run did not complete successfully: output file appears to be corrupt
----------------------------- Captured stderr call -----------------------------
WARNING: Planck function for lowest temperature not completely covered by opacity function [hyperion.dust.mean_opacities]
WARNING: Planck function for lowest temperature not completely covered by opacity function [hyperion.dust.emissivities]
------------------------------ Captured log call -------------------------------
mean_opacities.py 54 WARNING Planck function for lowest temperature not completely covered by opacity function
emissivities.py 46 WARNING Planck function for lowest temperature not completely covered by opacity function
_____________________________ test_voronoi_basics ______________________________
tmpdir = local('/tmp/tmp8ee8ggsh/test_voronoi_basics0')
def test_voronoi_basics(tmpdir):
# A test to check the interaction between C++, Fortran and Python,
# and to test the internal consistency of the Voronoi gridding.
from ...util.constants import au
np.random.seed(12343)
# Generate random points
N = 1000
x = np.random.uniform(-100 * au, 100 * au, N)
y = np.random.uniform(-100 * au, 100 * au, N)
z = np.random.uniform(-100 * au, 100 * au, N)
# Set up model
m = Model()
m.set_voronoi_grid(x, y, z)
kmh_dust = SphericalDust(os.path.join(DATA, 'kmh_lite.hdf5'))
m.add_density_grid(np.repeat(1.e-17, N), kmh_dust)
# Set up fly-around images
i = m.add_peeled_images()
i.set_wavelength_range(1, 900., 1000)
i.set_viewing_angles(np.repeat(85, 9), np.linspace(0., 60., 10)[:-1])
i.set_image_limits(-150 * au, 150 * au, -150 * au, 150 * au)
i.set_image_size(512, 512)
# We are just simulating a cube with a constant temperature of 20K
m.set_n_initial_iterations(0)
m.set_minimum_temperature(20.)
# Use raytracing for optimal signal-to-noise
m.set_raytracing(True)
m.set_n_photons(imaging=0, raytracing_sources=0, raytracing_dust=1e5)
m.write(tmpdir.join(random_id()).strpath)
> m.run(tmpdir.join(random_id()).strpath)
hyperion/model/tests/test_model.py:338:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hyperion.model.model.Model object at 0x7f72474472b0>
filename = '/tmp/tmp8ee8ggsh/test_voronoi_basics0/tyvnkIPUNmOYlzTDxawX4BS06AsbCZep'
logfile = None, mpi = False, n_processes = 36, overwrite = False
def run(self, filename=None, logfile=None, mpi=False, n_processes=multiprocessing.cpu_count(), overwrite=False):
"""
Run the model (should be called after `write()`).
Parameters
----------
filename : str, optional
The output filename for the model. If not specified, then if the
input file name contains ``.rtin``, then this is replaced with
``.rtout``, and otherwise ``.rtout`` is appended to the input
filename.
logfile : str, optional
If specified, the standard output and errors will be output to
this log file
mpi : bool, optional
Whether to run the model using the parallel (MPI) version of
Hyperion.
n_processes : int, optional
If ``mpi`` is set to ``True``, this can be used to specify the
number of processes to run Hyperion on.
overwrite : bool, optional
If set to ``True``, the output file is overwritten without
warning.
"""
if self.filename is None:
raise ValueError("Input file does not exist - write() needs to be called before run()")
if mpi:
option = '-m {0}'.format(n_processes)
else:
option = ''
input_file = self.filename
if filename is None:
if '.rtin' in self.filename:
output_file = self.filename.replace('.rtin', '.rtout')
else:
output_file = self.filename + '.rtout'
else:
output_file = filename
if overwrite and os.path.exists(output_file):
os.remove(output_file)
if logfile:
flog = open(logfile, 'wb')
returncode = subprocess.call('hyperion %s %s %s' % (option, input_file, output_file), stdout=flog, stderr=flog, shell=True)
else:
returncode = subprocess.call('hyperion %s %s %s' % (option, input_file, output_file), shell=True)
if returncode != 0:
> raise SystemExit("An error occurred, and the run did not complete")
E SystemExit: An error occurred, and the run did not complete
hyperion/model/model.py:1066: SystemExit
----------------------------- Captured stdout call -----------------------------
INFO: Updating Voronoi Tesselation [hyperion.grid.voronoi_grid]
INFO: Computing the tessellation via voro++ [hyperion.grid.voronoi_helpers]
------------------------------------------------------------
Hyperion v1.0.0
Started on 05 February 2019 at 14:58:01
Input: /tmp/tmp8ee8ggsh/test_voronoi_basics0/UPQv05YK9kSq34sFIybmGfajM21LHDNR
Output: /tmp/tmp8ee8ggsh/test_voronoi_basics0/tyvnkIPUNmOYlzTDxawX4BS06AsbCZep
------------------------------------------------------------
[main] using random seed = -124902
[dust] reading dust_001
Run did not complete successfully: output file appears to be corrupt
----------------------------- Captured stderr call -----------------------------
WARNING: Version 1 dust file detected - discarding mean opacities and recomputing them [hyperion.dust.dust_type]
At line 147 of file src/grid/grid_geometry_voronoi.f90
Fortran runtime error: Array bound mismatch for dimension 1 of array 'geo' (14/15)
Error termination. Backtrace:
#0 0x7ffb8c4282da in ???
#1 0x7ffb8c428ec5 in ???
#2 0x7ffb8c429297 in ???
#3 0x561fd13acb80 in __grid_geometry_specific_MOD_setup_grid_geometry
at src/grid/grid_geometry_voronoi.f90:147
#4 0x561fd1401e9d in __setup_MOD_setup_initial
at src/main/setup_rt.f90:172
#5 0x561fd140642e in MAIN__
at src/main/main.f90:167
#6 0x561fd1407081 in main
at src/main/main.f90:3
------------------------------ Captured log call -------------------------------
dust_type.py 339 WARNING Version 1 dust file detected - discarding mean opacities and recomputing them
voronoi_grid.py 235 INFO Updating Voronoi Tesselation
voronoi_helpers.py 123 INFO Computing the tessellation via voro++
__________________ TestCylindricalBase.test_ptsource_vertices __________________
self = <hyperion.model.tests.test_propagation.TestCylindricalBase object at 0x7f72461dc080>
tmpdir = local('/tmp/tmp8ee8ggsh/test_ptsource_vertices4')
def test_ptsource_vertices(self, tmpdir):
'''Point sources exactly on the vertices'''
for iw in range(len(self.w) - 1):
for iz in range(len(self.z)):
for ip in range(len(self.p)):
s = self.m.add_point_source()
x = self.w[iw] * np.cos(self.p[ip])
y = self.w[iw] * np.sin(self.p[ip])
z = self.z[iz]
# Clip to w=0 (necessary due to numerical precision)
x = 0 if abs(x) < 1.e-10 else x
y = 0 if abs(y) < 1.e-10 else y
s.position = (x, y, z)
s.luminosity = 1
s.temperature = 5000.
s = self.m.add_point_source()
s.position = (0., 0., 0.)
s.luminosity = 1
s.temperature = 5000.
self.m.set_n_initial_iterations(1)
self.m.set_n_photons(initial=100000, imaging=0)
self.m.write(tmpdir.join(random_id()).strpath)
file_out = tmpdir.join(random_id()).strpath
> self.m.run(file_out)
hyperion/model/tests/test_propagation.py:411:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hyperion.model.model.Model object at 0x7f72461dcd68>
filename = '/tmp/tmp8ee8ggsh/test_ptsource_vertices4/HfA5sQXvBumgykOYJj8WErZbKlzMe9Dc'
logfile = None, mpi = False, n_processes = 36, overwrite = False
def run(self, filename=None, logfile=None, mpi=False, n_processes=multiprocessing.cpu_count(), overwrite=False):
"""
Run the model (should be called after `write()`).
Parameters
----------
filename : str, optional
The output filename for the model. If not specified, then if the
input file name contains ``.rtin``, then this is replaced with
``.rtout``, and otherwise ``.rtout`` is appended to the input
filename.
logfile : str, optional
If specified, the standard output and errors will be output to
this log file
mpi : bool, optional
Whether to run the model using the parallel (MPI) version of
Hyperion.
n_processes : int, optional
If ``mpi`` is set to ``True``, this can be used to specify the
number of processes to run Hyperion on.
overwrite : bool, optional
If set to ``True``, the output file is overwritten without
warning.
"""
if self.filename is None:
raise ValueError("Input file does not exist - write() needs to be called before run()")
if mpi:
option = '-m {0}'.format(n_processes)
else:
option = ''
input_file = self.filename
if filename is None:
if '.rtin' in self.filename:
output_file = self.filename.replace('.rtin', '.rtout')
else:
output_file = self.filename + '.rtout'
else:
output_file = filename
if overwrite and os.path.exists(output_file):
os.remove(output_file)
if logfile:
flog = open(logfile, 'wb')
returncode = subprocess.call('hyperion %s %s %s' % (option, input_file, output_file), stdout=flog, stderr=flog, shell=True)
else:
returncode = subprocess.call('hyperion %s %s %s' % (option, input_file, output_file), shell=True)
if returncode != 0:
> raise SystemExit("An error occurred, and the run did not complete")
E SystemExit: An error occurred, and the run did not complete
hyperion/model/model.py:1066: SystemExit
---------------------------- Captured stderr setup -----------------------------
WARNING: Planck function for lowest temperature not completely covered by opacity function [hyperion.dust.mean_opacities]
WARNING: Planck function for lowest temperature not completely covered by opacity function [hyperion.dust.emissivities]
------------------------------ Captured log setup ------------------------------
mean_opacities.py 54 WARNING Planck function for lowest temperature not completely covered by opacity function
emissivities.py 46 WARNING Planck function for lowest temperature not completely covered by opacity function
----------------------------- Captured stdout call -----------------------------
------------------------------------------------------------
Hyperion v1.0.0
Started on 05 February 2019 at 15:00:38
Input: /tmp/tmp8ee8ggsh/test_ptsource_vertices4/pUO0rb2YCZNPTEwXGQKcIxy6fFt5iqn1
Output: /tmp/tmp8ee8ggsh/test_ptsource_vertices4/HfA5sQXvBumgykOYJj8WErZbKlzMe9Dc
------------------------------------------------------------
[main] using random seed = -124902
[dust] reading dust_001
[setup_grid_geometry] Reading cylindrical polar grid
[grid_physics] reading density grid
[grid_physics] reading minimum_specific_energy
[grid_physics] checking energy_abs
WARNING: specific_energy below minimum allowed in some cells - resetting [update_energy_abs]
[grid_physics] updating energy_abs_tot
[sources] setting up sources
[main] starting Lucy iteration 1
[grid_physics] pre-computing jnu_var
# Photons CPU time (sec) Photons/sec
----------------------------------------------
Run did not complete successfully: output file appears to be corrupt
----------------------------- Captured stderr call -----------------------------
At line 683 of file src/grid/grid_geometry_cylindrical_3d.f90
Fortran runtime error: Index '18' of dimension 1 of array 'geo%w2' above upper bound of 17
Error termination. Backtrace:
#0 0x7fbb73aad2da in ???
#1 0x7fbb73aadec5 in ???
#2 0x7fbb73aae297 in ???
#3 0x55f375abd831 in __grid_geometry_specific_MOD_find_wall
at src/grid/grid_geometry_cylindrical_3d.f90:683
#4 0x55f375afb0e9 in __grid_propagate_MOD_grid_integrate
at src/grid/grid_propagate_3d.f90:103
#5 0x55f375b1b131 in __iteration_lucy_MOD_do_lucy
at src/main/iter_lucy.f90:156
#6 0x55f375b1e72c in MAIN__
at src/main/main.f90:183
#7 0x55f375b1f2a0 in main
at src/main/main.f90:3
______________ TestCylindricalBase.test_ptsource_vertices_noclip _______________
self = <hyperion.model.tests.test_propagation.TestCylindricalBase object at 0x7f7245fdb128>
tmpdir = local('/tmp/tmp8ee8ggsh/test_ptsource_vertices_noclip1')
def test_ptsource_vertices_noclip(self, tmpdir):
'''Point sources on vertices, but without clipping'''
for iw in range(len(self.w) - 1):
for iz in range(len(self.z)):
for ip in range(len(self.p)):
s = self.m.add_point_source()
x = self.w[iw] * np.cos(self.p[ip])
y = self.w[iw] * np.sin(self.p[ip])
z = self.z[iz]
s.position = (x, y, z)
s.luminosity = 1
s.temperature = 5000.
s = self.m.add_point_source()
s.position = (0., 0., 0.)
s.luminosity = 1
s.temperature = 5000.
self.m.set_n_initial_iterations(1)
self.m.set_n_photons(initial=100000, imaging=0)
self.m.write(tmpdir.join(random_id()).strpath)
file_out = tmpdir.join(random_id()).strpath
> self.m.run(file_out)
hyperion/model/tests/test_propagation.py:466:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hyperion.model.model.Model object at 0x7f7245fdbef0>
filename = '/tmp/tmp8ee8ggsh/test_ptsource_vertices_noclip1/xd6RoNaWA3IUKe8lSFZ0jsM4zhLPQJHG'
logfile = None, mpi = False, n_processes = 36, overwrite = False
def run(self, filename=None, logfile=None, mpi=False, n_processes=multiprocessing.cpu_count(), overwrite=False):
"""
Run the model (should be called after `write()`).
Parameters
----------
filename : str, optional
The output filename for the model. If not specified, then if the
input file name contains ``.rtin``, then this is replaced with
``.rtout``, and otherwise ``.rtout`` is appended to the input
filename.
logfile : str, optional
If specified, the standard output and errors will be output to
this log file
mpi : bool, optional
Whether to run the model using the parallel (MPI) version of
Hyperion.
n_processes : int, optional
If ``mpi`` is set to ``True``, this can be used to specify the
number of processes to run Hyperion on.
overwrite : bool, optional
If set to ``True``, the output file is overwritten without
warning.
"""
if self.filename is None:
raise ValueError("Input file does not exist - write() needs to be called before run()")
if mpi:
option = '-m {0}'.format(n_processes)
else:
option = ''
input_file = self.filename
if filename is None:
if '.rtin' in self.filename:
output_file = self.filename.replace('.rtin', '.rtout')
else:
output_file = self.filename + '.rtout'
else:
output_file = filename
if overwrite and os.path.exists(output_file):
os.remove(output_file)
if logfile:
flog = open(logfile, 'wb')
returncode = subprocess.call('hyperion %s %s %s' % (option, input_file, output_file), stdout=flog, stderr=flog, shell=True)
else:
returncode = subprocess.call('hyperion %s %s %s' % (option, input_file, output_file), shell=True)
if returncode != 0:
> raise SystemExit("An error occurred, and the run did not complete")
E SystemExit: An error occurred, and the run did not complete
hyperion/model/model.py:1066: SystemExit
---------------------------- Captured stderr setup -----------------------------
WARNING: Planck function for lowest temperature not completely covered by opacity function [hyperion.dust.mean_opacities]
WARNING: Planck function for lowest temperature not completely covered by opacity function [hyperion.dust.emissivities]
------------------------------ Captured log setup ------------------------------
mean_opacities.py 54 WARNING Planck function for lowest temperature not completely covered by opacity function
emissivities.py 46 WARNING Planck function for lowest temperature not completely covered by opacity function
----------------------------- Captured stdout call -----------------------------
------------------------------------------------------------
Hyperion v1.0.0
Started on 05 February 2019 at 15:00:53
Input: /tmp/tmp8ee8ggsh/test_ptsource_vertices_noclip1/0DuHZ9Ld56s8OYlTJ7ibFnhKcjzq41pV
Output: /tmp/tmp8ee8ggsh/test_ptsource_vertices_noclip1/xd6RoNaWA3IUKe8lSFZ0jsM4zhLPQJHG
------------------------------------------------------------
[main] using random seed = -124902
[dust] reading dust_001
[setup_grid_geometry] Reading cylindrical polar grid
[grid_physics] reading density grid
[grid_physics] reading minimum_specific_energy
[grid_physics] checking energy_abs
WARNING: specific_energy below minimum allowed in some cells - resetting [update_energy_abs]
[grid_physics] updating energy_abs_tot
[sources] setting up sources
[main] starting Lucy iteration 1
[grid_physics] pre-computing jnu_var
# Photons CPU time (sec) Photons/sec
----------------------------------------------
Run did not complete successfully: output file appears to be corrupt
----------------------------- Captured stderr call -----------------------------
At line 683 of file src/grid/grid_geometry_cylindrical_3d.f90
Fortran runtime error: Index '18' of dimension 1 of array 'geo%w2' above upper bound of 17
Error termination. Backtrace:
#0 0x7f69bc5062da in ???
#1 0x7f69bc506ec5 in ???
#2 0x7f69bc507297 in ???
#3 0x5586c8604831 in __grid_geometry_specific_MOD_find_wall
at src/grid/grid_geometry_cylindrical_3d.f90:683
#4 0x5586c86420e9 in __grid_propagate_MOD_grid_integrate
at src/grid/grid_propagate_3d.f90:103
#5 0x5586c8662131 in __iteration_lucy_MOD_do_lucy
at src/main/iter_lucy.f90:156
#6 0x5586c866572c in MAIN__
at src/main/main.f90:183
#7 0x5586c86662a0 in main
at src/main/main.f90:3
``
If I compile Hyperion with
--enable-debug
and then run the tests, there are a few failures that need to be investigated: