-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Continue cmontecarlo tests refactor. Extend #530. #544
Conversation
['packet_params', 'expected'], | ||
[({'nu': 0.1, 'mu': 0.3, 'r': 7.5e14}, 0.0), | ||
({'nu': 0.2, 'mu': -.3, 'r': 7.7e14}, 0.0)] | ||
) |
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.
@wkerzendorf @yeganer There might be a problem in calculate_chi_bf
's implementation, or I wonder chi_bf
is zero for these test cases. I found a FIXME note in the underlying method, and I suspect that this method is indeed not thread-safe.
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.
skip calculate_chi_bf
7f6750d
to
d996278
Compare
- Add a TODO as there is a problem in underlying method. Alongwith it also a skip marker is added.
c283397
to
d6b4b4e
Compare
After #547 was merged, all the methods stopped throwing a segfault, except |
I don't think it's Is the list in the first post of this PR complete? If not, can you please add ALL functions which are in cmontecarlo.c, including those you already wrote tests for in the previous PR. This gives us a nice overview of all functions and we can categorize them. For the moment I think the tests are mostly done because most of the functions left aren't relevant at the moment. |
d6b4b4e
to
6e7be8c
Compare
Important
Difficult to test
Not yet relevant |
- Add skip markers to two methods: test_montecarlo_bound_free_scatter test_montecarlo_free_free_scatter
901690b
to
50cf9f0
Compare
- RKState struct in python implementation had a 'key' member which was a pointer to c_ulong type array. - The C counterpart had a static array declaration, and hence the memory allocated to both Structs was different, hence causing repeated segfaults, false assertions and fails.
@karandesai-96 there are several checkboxes not checked. You need to tell us if this PR is finished and what you want to do with the rest of the textboxes. |
@wkerzendorf These tests were classified in three different categories by @yeganer a few days back and I set my priorities accordingly. So here it goes:
I would need your opinion about the further work to do here. Should I list out the parameters which I need as a test case for |
Moreover, before merging we will make sure to remove test_cmontecarlo.c and test_montecarlo.so completely. These tests directly wrap around C methods and no longer rely on tests written in C. |
@karandesai-96 finish this PR in the sense that you document
This needs to go in the description of the PR. As it stands you are asking us to merge an unfinished PR. When you are done with something like this - the PR description should be cleaned up. @unoebauer's PRs are a very good example of how to do this. I should be able to go into a PR and figure out exactly what it does - what remains to be done, etc. |
- New tests no longer require these C tests. They directly wrap C methods.
Summary
Explanation@karandesai-96 I had a look at the PR and I think it's mostly done. There is still some room for improvements. @wkerzendorf you can correct me if I'm wrong but in my opinion we should skip all functions listed as "not yet relevant", too. These functions are related to the continuum interactions which are developed by @chvogl. Running them for the current master doesn't seem necessary to me. Finally I'd suggest you group the functions inside This PR aims to completely replace the tests for the C-extension. As such we should remove ALL files associated with testing the C part. I know there is |
- Tests are reordered according to category: - Important tests. - Not yet relevant tests. - Block comments have been added, which desribe these tests. - @pytest.mark.skipif added to 'Not yet relevant' category tests.
f356cfd
to
acec56c
Compare
Hi @yeganer I have done most of the work suggested. I have a doubt:
test_rpacket.py wraps around this shared object. Should I remove that as well ? Or should I apply |
Remove test_rpacket.py |
@yeganer I have completed the points put up by you. If the methods are |
@tardis-sn/tardis-core what is going on here? From my side this looks good. |
@yeganer @unoebauer I'm signing off on this. Can one of you check and merge? |
Reviewing the PR now... |
Looks good - merging. |
This PR extends the work of #530. The tests which wrapped the C tests from test_cmontecarlo.so were redesigned to directly wrap C methods from cmontecarlo.so. A couple of TODOs commented in the file during the work of #530 have been resolved here.
The checklist states the tests which were added / refactored. The commit where the test was added is mentioned within parenthesis:
(No commit in parenthesis means the work on that method was done in #530.)
line_search
( 5441c00 )reverse_binary_search
( 50cf9f0 )rpacket_doppler_factor
compute_distance2boundary
compute_distance2line
compute_distance2continuum
move_packet
( e7a7b4e )increment_j_blue_estimator
move_packet_across_shell_boundary
( fd9d4c1 )montecarlo_thomson_scatter
( a776364 )montecarlo_line_scatter
Not yet relevant:
These tests will have to be rewritten in future as the underlying code is experimental and at early development stage. Few of these tests have a
@pytest.mark.skipif
decorator too.montecarlo_continuum_event_handler
( 870e5e4 )montecarlo_free_free_scatter
( 4f4a1e8 )montecarlo_bound_free_scatter
( 6e7be8c )bf_cross_section
( 1f099af )calculate_chi_bf
( 0de7cba )After writing the above mentioned tests, following are undertaken as a routine to wrap up this task:
test_<func>
counterpart in python ( 02d1f13, acec56c )skip
with a descriptive reason ( ^ same )test_*.c
files ( 2b8465c ) and the building oftest_cmontecarlo.so
( 70dcfac )These methods are yet not tested. Refer #556 for details:
montecarlo_one_packet
montecarlo_one_packet_loop
montecarlo_main_loop
montecarlo_event_handler
macro_atom