-
-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tests for composition #2944
base: master
Are you sure you want to change the base?
tests for composition #2944
Conversation
*beep* *bop* Hi, human. I'm the @tardis-bot and couldn't find your records in my database. I think we don't know each other, or you changed your credentials recently. Please add your name and email to In case you need to map an existing alias, follow this example. |
*beep* *bop* 31 W291 [*] Trailing whitespace
14 E999 [ ] SyntaxError: Expected ',', found ':'
10 E902 [ ] No such file or directory (os error 2)
7 G004 [ ] Logging statement uses f-string
7 I001 [*] Import block is un-sorted or un-formatted
6 W293 [*] Blank line contains whitespace
6 F401 [*] `tardis.io.model.parse_atom_data.parse_atom_data` imported but unused
5 INP001 [ ] File `tardis/analysis/opacities.py` is part of an implicit namespace package. Add an `__init__.py`.
4 RET505 [ ] Unnecessary `else` after `return` statement
3 W292 [*] No newline at end of file
2 PIE808 [*] Unnecessary `start` argument in `range`
2 PTH117 [ ] `os.path.isabs()` should be replaced by `Path.is_absolute()`
2 E712 [*] Avoid equality comparisons to `False`; use `if not ...:` for false checks
2 W605 [*] Invalid escape sequence: `\A`
2 F811 [ ] Redefinition of unused `monkeysession` from line 6
1 ANN204 [ ] Missing return type annotation for special method `__getitem__`
1 RET506 [ ] Unnecessary `else` after `raise` statement
1 E703 [*] Statement ends with an unnecessary semicolon
1 D202 [*] No blank lines allowed after function docstring (found 1)
1 D406 [*] Section name should end with a newline ("Returns")
1 D407 [*] Missing dashed underline after section ("Returns")
1 F541 [*] f-string without any placeholders
Complete output(might be large): .github/actions/setup_env/action.yml:4:8: E999 SyntaxError: Expected an expression
.github/actions/setup_env/action.yml:17:1: W293 [*] Blank line contains whitespace
.github/actions/setup_env/action.yml:19:15: W291 [*] Trailing whitespace
.github/actions/setup_env/action.yml:24:1: W293 [*] Blank line contains whitespace
.github/actions/setup_lfs/action.yml:5:8: E999 SyntaxError: Expected an expression
.github/workflows/benchmarks.yml:3:4: E999 SyntaxError: Expected an expression
.github/workflows/benchmarks.yml:20:5: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:87:49: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:117:81: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:118:54: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:205:1: W293 [*] Blank line contains whitespace
.github/workflows/benchmarks.yml:224:22: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:225:170: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:227:84: W291 [*] Trailing whitespace
.github/workflows/benchmarks.yml:244:1: W293 [*] Blank line contains whitespace
.github/workflows/build-docs.yml:7:4: E999 SyntaxError: Expected an expression
.github/workflows/lfs-cache.yml:1:1: E902 No such file or directory (os error 2)
.github/workflows/tests.yml:7:4: E999 SyntaxError: Expected an expression
.mailmap:1:38: E999 SyntaxError: Expected an expression
.mailmap:294:39: W292 [*] No newline at end of file
CHANGELOG.md:4:15: E999 SyntaxError: Expected ',', found ':'
CITATION.cff:3:1: E999 SyntaxError: Invalid annotated assignment target
README.rst:1:1: E999 SyntaxError: Expected a statement
docs/contributing/development/benchmarks.rst:1:1: E999 SyntaxError: Expected a statement
docs/contributing/development/continuous_integration.rst:1:1: E999 SyntaxError: Expected a statement
docs/contributing/development/continuous_integration.rst:16:76: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:18:68: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:21:92: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:22:86: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:48:1: W293 [*] Blank line contains whitespace
docs/contributing/development/continuous_integration.rst:82:70: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:97:78: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:98:94: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:99:83: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:100:96: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:102:97: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:103:62: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:110:90: W291 [*] Trailing whitespace
docs/contributing/development/continuous_integration.rst:111:19: W292 [*] No newline at end of file
docs/contributing/development/running_tests.rst:1:1: E999 SyntaxError: Expected a statement
docs/contributing/development/running_tests.rst:59:112: W291 [*] Trailing whitespace
docs/contributing/development/running_tests.rst:60:124: W291 [*] Trailing whitespace
docs/contributing/development/running_tests.rst:64:92: W291 [*] Trailing whitespace
docs/contributing/development/running_tests.rst:65:107: W291 [*] Trailing whitespace
docs/contributing/development/running_tests.rst:75:62: W291 [*] Trailing whitespace
docs/contributing/development/running_tests.rst:76:85: W292 [*] No newline at end of file
docs/io/grid/how_to_TardisGridTutorial.ipynb:cell 2:1:1: I001 [*] Import block is un-sorted or un-formatted
docs/io/grid/how_to_TardisGridTutorial.ipynb:cell 7:2:74: W291 [*] Trailing whitespace
docs/io/grid/how_to_TardisGridTutorial.ipynb:cell 14:1:47: W291 [*] Trailing whitespace
docs/io/grid/how_to_TardisGridTutorial.ipynb:cell 14:4:46: E703 [*] Statement ends with an unnecessary semicolon
docs/io/grid/how_to_TardisGridTutorial.ipynb:cell 15:2:55: W291 [*] Trailing whitespace
docs/io/output/how_to_rpacket_tracking.ipynb:cell 12:1:62: W291 [*] Trailing whitespace
docs/physics/plasma/equilibrium/tardis_solver_cmfgen.ipynb:1:1: E902 No such file or directory (os error 2)
docs/physics/setup/model.ipynb:cell 2:2:1: I001 [*] Import block is un-sorted or un-formatted
docs/physics/setup/model.ipynb:cell 25:19:12: F541 [*] f-string without any placeholders
docs/quickstart.ipynb:cell 12:1:39: W291 [*] Trailing whitespace
docs/quickstart.ipynb:cell 12:5:35: W291 [*] Trailing whitespace
docs/quickstart.ipynb:cell 16:10:26: W605 [*] Invalid escape sequence: `\A`
docs/quickstart.ipynb:cell 16:11:40: W605 [*] Invalid escape sequence: `\A`
docs/resources/credits.rst:1:1: E999 SyntaxError: Expected a statement
docs/workflows/v_inner_solver_workflow.ipynb:1:1: E902 No such file or directory (os error 2)
tardis/analysis/opacities.py:1:1: INP001 File `tardis/analysis/opacities.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/grid/tests/test_grid.py:1:1: INP001 File `tardis/grid/tests/test_grid.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/io/configuration/config_reader.py:53:29: G004 Logging statement uses f-string
tardis/io/configuration/config_reader.py:117:9: RET505 Unnecessary `else` after `return` statement
tardis/io/configuration/config_reader.py:141:13: RET505 Unnecessary `else` after `return` statement
tardis/io/configuration/config_reader.py:218:29: G004 Logging statement uses f-string
tardis/io/configuration/schemas/montecarlo_definitions.yml:1:13: E999 SyntaxError: Expected an expression
tardis/io/model/parse_geometry_configuration.py:50:12: PTH117 `os.path.isabs()` should be replaced by `Path.is_absolute()`
tardis/io/model/readers/tests/test_arepo_parser.py:1:1: INP001 File `tardis/io/model/readers/tests/test_arepo_parser.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/model/base.py:340:12: PTH117 `os.path.isabs()` should be replaced by `Path.is_absolute()`
tardis/model/base.py:375:21: G004 Logging statement uses f-string
tardis/model/matter/tests/test_composition.py:1:1: INP001 File `tardis/model/matter/tests/test_composition.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/model/matter/tests/test_composition.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/model/matter/tests/test_composition.py:9:45: F401 [*] `tardis.io.model.parse_atom_data.parse_atom_data` imported but unused
tardis/model/matter/tests/test_composition.py:51:1: W293 [*] Blank line contains whitespace
tardis/opacities/macro_atom/macroatom_state.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/opacities/opacity_state.py:210:9: ANN204 Missing return type annotation for special method `__getitem__`
tardis/opacities/opacity_state.py:216:9: D407 [*] Missing dashed underline after section ("Returns")
tardis/opacities/opacity_state.py:216:9: D406 [*] Section name should end with a newline ("Returns")
tardis/opacities/opacity_state.py:251:5: D202 [*] No blank lines allowed after function docstring (found 1)
tardis/opacities/tests/__init__.py:1:1: E902 No such file or directory (os error 2)
tardis/opacities/tests/test_opacity_state_numba.py:1:1: INP001 File `tardis/opacities/tests/test_opacity_state_numba.py` is part of an implicit namespace package. Add an `__init__.py`.
tardis/opacities/tests/test_opacity_state_numba.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/plasma/equilibrium/rates/__init__.py:2:5: F401 `tardis.plasma.equilibrium.rates.collision_strengths.UpsilonCMFGENSolver` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/equilibrium/rates/__init__.py:3:5: F401 `tardis.plasma.equilibrium.rates.collision_strengths.UpsilonRegemorterSolver` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/equilibrium/rates/__init__.py:6:5: F401 `tardis.plasma.equilibrium.rates.collisional_rates.ThermalCollisionalRateSolver` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/equilibrium/rates/__init__.py:9:5: F401 `tardis.plasma.equilibrium.rates.radiative_rates.RadiativeRatesSolver` imported but unused; consider removing, adding to `__all__`, or using a redundant alias
tardis/plasma/equilibrium/rates/collisional_ionization_rates.py:1:1: E902 No such file or directory (os error 2)
tardis/plasma/equilibrium/rates/collisional_ionization_strengths.py:1:1: E902 No such file or directory (os error 2)
tardis/plasma/equilibrium/rates/photoionization_rates.py:1:1: E902 No such file or directory (os error 2)
tardis/plasma/equilibrium/rates/photoionization_strengths.py:1:1: E902 No such file or directory (os error 2)
tardis/spectrum/formal_integral.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/spectrum/formal_integral.py:358:13: RET506 Unnecessary `else` after `raise` statement
tardis/spectrum/formal_integral.py:698:5: RET505 Unnecessary `else` after `return` statement
tardis/spectrum/formal_integral.py:734:5: RET505 Unnecessary `else` after `return` statement
tardis/transport/montecarlo/tests/conftest.py:14:5: F811 Redefinition of unused `opacity_state_initialize` from line 7
tardis/visualization/tools/tests/test_convergence_plot.py:3:1: I001 [*] Import block is un-sorted or un-formatted
tardis/visualization/tools/tests/test_convergence_plot.py:6:36: F401 [*] `tardis.tests.test_util.monkeysession` imported but unused
tardis/visualization/tools/tests/test_convergence_plot.py:87:24: PIE808 [*] Unnecessary `start` argument in `range`
tardis/visualization/tools/tests/test_convergence_plot.py:111:22: PIE808 [*] Unnecessary `start` argument in `range`
tardis/visualization/tools/tests/test_convergence_plot.py:198:9: E712 Avoid equality comparisons to `False`; use `if not ...:` for false checks
tardis/visualization/tools/tests/test_convergence_plot.py:215:9: E712 Avoid equality comparisons to `False`; use `if not ...:` for false checks
tardis/visualization/tools/tests/test_convergence_plot.py:220:40: F811 Redefinition of unused `monkeysession` from line 6
tardis/workflows/simple_tardis_workflow.py:230:17: G004 Logging statement uses f-string
tardis/workflows/simple_tardis_workflow.py:449:17: G004 Logging statement uses f-string
tardis/workflows/standard_tardis_workflow.py:172:13: G004 Logging statement uses f-string
tardis/workflows/standard_tardis_workflow.py:212:17: G004 Logging statement uses f-string
tardis/workflows/util.py:1:1: E902 No such file or directory (os error 2)
tardis/workflows/v_inner_solver.py:1:1: E902 No such file or directory (os error 2)
Found 110 errors.
[*] 58 fixable with the `--fix` option (2 hidden fixes can be enabled with the `--unsafe-fixes` option).
|
*beep* *bop* Significantly changed benchmarks: All benchmarks: Benchmarks that have stayed the same:
| Change | Before [13c9a314] <master> | After [766979a0] | Ratio | Benchmark (Parameter) |
|----------|------------------------------|---------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------|
| | 561±200ns | 501±100ns | ~0.89 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_compton_opacity_calculation |
| | 671±100ns | 561±100ns | ~0.84 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_photoabsorption_opacity_calculation |
| | 61.8±30μs | 45.1±30μs | ~0.73 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_scatter |
| | 39.9±10μs | 27.1±8μs | ~0.68 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_last_interaction_tracker_list |
| | 541±100ns | 572±200ns | 1.06 | opacities_opacity.BenchmarkMontecarloMontecarloNumbaOpacities.time_pair_creation_opacity_calculation |
| | 43.1±30μs | 45.0±30μs | 1.05 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_line_emission |
| | 6.84±0.8μs | 7.16±0.8μs | 1.05 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket |
| | 204±0.07ns | 212±0.6ns | 1.04 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_intensity_black_body |
| | 7.44±3μs | 7.63±2μs | 1.03 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_volley |
| | 65.4±0.04ms | 66.1±0.1ms | 1.01 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_rpacket_trackers_to_dataframe |
| | 1.07±0m | 1.07±0m | 1.00 | run_tardis.BenchmarkRunTardis.time_run_tardis_rpacket_tracking |
| | 2.12±0m | 2.11±0m | 1.00 | spectrum_formal_integral.BenchmarkTransportMontecarloFormalIntegral.time_FormalIntegrator_functions |
| | 734±1ns | 737±1ns | 1.00 | transport_montecarlo_interaction.BenchmarkTransportMontecarloInteraction.time_thomson_scatter |
| | 38.6±0.07μs | 38.5±0.09μs | 1.00 | transport_montecarlo_packet_trackers.BenchmarkTransportMontecarloPacketTrackers.time_generate_rpacket_tracker_list |
| | 1.22±0μs | 1.21±0μs | 0.99 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_boundary |
| | 2.23±2μs | 2.21±2μs | 0.99 | transport_montecarlo_estimators_radfield_estimator_calcs.BenchmarkMontecarloMontecarloNumbaPacket.time_update_line_estimators |
| | 1.86±0.01ms | 1.84±0.01ms | 0.99 | transport_montecarlo_main_loop.BenchmarkTransportMontecarloMontecarloMainLoop.time_montecarlo_main_loop |
| | 4.30±0ms | 4.22±0.01ms | 0.98 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('macroatom') |
| | 40.3±0.1s | 39.3±0.09s | 0.97 | run_tardis.BenchmarkRunTardis.time_run_tardis |
| | 2.87±0.4ms | 2.77±0.5ms | 0.97 | transport_montecarlo_single_packet_loop.BenchmarkTransportMontecarloSinglePacketLoop.time_single_packet_loop |
| | 3.42±0.7μs | 3.29±0.4μs | 0.96 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_bad_vpacket |
| | 3.35±0.02ms | 3.15±0.02ms | 0.94 | opacities_opacity_state.BenchmarkOpacitiesOpacityState.time_opacity_state_initialize('scatter') |
| | 4.03±0.5μs | 3.76±0.7μs | 0.93 | transport_montecarlo_vpacket.BenchmarkMontecarloMontecarloNumbaVpacket.time_trace_vpacket_within_shell |
| | 1.70±0.4μs | 1.56±0.4μs | 0.92 | transport_geometry_calculate_distances.BenchmarkTransportGeometryCalculateDistances.time_calculate_distance_line |
If you want to see the graph of the results, you can check it here |
def test_elemental_mass_fraction(composition_instance): | ||
elemental_mass_fraction = composition_instance.elemental_mass_fraction | ||
assert isinstance(elemental_mass_fraction, pd.DataFrame) | ||
np.testing.assert_allclose(elemental_mass_fraction.sum(), 1.0, rtol=1e-3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only a tolerance of 1e-3? That seems large.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No specific reason why exactly 1e-3. thought it would be acceptable tolerance. Will remove.
mass_fractions.index | ||
) | ||
|
||
expected_density = mass_fractions.multiply(density_value).divide( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to expected_number_density
@@ -53,6 +53,13 @@ def test_get_species_interactions( | |||
) | |||
assert species_interactions_df.shape == (expected_df_length, 1) | |||
|
|||
def test_get_middle_half_edges(self, wavelength_range, filter_mode): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought a separate PR for this small test wouldnt look good. I'll create a separate one for this to keep everything clean 👍
|
||
|
||
@pytest.fixture(scope="function") | ||
def composition_instance(config_verysimple): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at some of the other fixtures we have defined throughout the code. We would prefer a more consistent naming scheme than this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have made changes. Kindly take a look. Thanks.
Hi, |
can you use the regression data. |
Made the changes. Kindly take a look at my PR now. Edit: I made use of regression data fixture as asked. Before running the tests I ran the tests with generate reference. Its creating files in the regression data.
Thanks. |
📝 Description
composition tests written and also added a small test for line info