Skip to content

Commit

Permalink
Checking failing tests on Azure (#995)
Browse files Browse the repository at this point in the history
* checking failing tests by pinning astropy version to 3.2.1

* printing config data for debugging

* running only integral test to debug further

* disabling openMP and adding debug statements

* adding inttypes.h to make data types platform independent

* free memory to avoid memory leaks

* remove caching for spectrum_integrated
  • Loading branch information
kaushik94 authored and wkerzendorf committed Jan 20, 2020
1 parent 5c90622 commit ff873fb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion azure-pipelines/simple_test_framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
source activate tardis
conda install -y pytest-cov
pip install git+https://github.com/tonybaloney/pytest-azurepipelines.git
pytest tardis --tardis-refdata=$(ref.data.home) --cov=tardis --cov-report=xml --cov-report=html
pytest -s tardis/tests/test_tardis_full_formal_integral.py --tardis-refdata=$(ref.data.home) --cov=tardis --cov-report=xml --cov-report=html
displayName: 'TARDIS test'
Expand Down
8 changes: 5 additions & 3 deletions tardis/montecarlo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ def spectrum_virtual(self):

@property
def spectrum_integrated(self):
if self._spectrum_integrated is None:
self._spectrum_integrated = self.integrator.calculate_spectrum(
self.spectrum_frequency[:-1], **self.integrator_settings)
self._spectrum_integrated = self.integrator.calculate_spectrum(
self.spectrum_frequency[:-1], **self.integrator_settings)
# if self._spectrum_integrated is None:
# self._spectrum_integrated = self.integrator.calculate_spectrum(
# self.spectrum_frequency[:-1], **self.integrator_settings)
return self._spectrum_integrated

@property
Expand Down
6 changes: 4 additions & 2 deletions tardis/montecarlo/src/integrator.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define _USE_MATH_DEFINES

#include <inttypes.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>
Expand Down Expand Up @@ -210,7 +211,7 @@ _formal_integral(
for (i = 0; i < size_tau; ++i) {
exp_tau[i] = exp( -storage->line_lists_tau_sobolevs_i[i]);
}
calculate_p_values(storage->r_outer_i[storage->no_of_shells_i - 1], N, pp);
calculate_p_values(R_max, N, pp);
// Done with the initialization

// Loop over wavelengths in spectrum
Expand Down Expand Up @@ -335,7 +336,8 @@ _formal_integral(
}
}
// Free everything allocated on heap
free(exp_tau);
printf("\n");
}
return L;
}
}
4 changes: 3 additions & 1 deletion tardis/tests/test_tardis_full_formal_integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from tardis.simulation.base import Simulation
from tardis.io.config_reader import Configuration

import astropy

config_line_modes = ['downbranch', 'macroatom']
interpolate_shells = [-1, 30]
Expand All @@ -24,6 +24,7 @@ def base_config(request):
config["montecarlo"]["no_of_virtual_packets"] = 0
config["spectrum"]["method"] = "integrated"
config["spectrum"]["integrated"]["points"] = 200
print("config", config)

return config

Expand Down Expand Up @@ -92,6 +93,7 @@ def test_spectrum_integrated(self, runner, refdata):
luminosity = u.Quantity(
refdata('spectrum_integrated/luminosity'), 'erg /s')

print("actual, desired: ", luminosity, runner.spectrum_integrated.luminosity)
assert_quantity_allclose(
runner.spectrum_integrated.luminosity,
luminosity)
2 changes: 1 addition & 1 deletion tardis_env3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- numpy=1.15
- scipy=1.1
- pandas=0.24
- astropy=3
- astropy=3.2.1


- numba=0.43
Expand Down

0 comments on commit ff873fb

Please sign in to comment.