-
-
Notifications
You must be signed in to change notification settings - Fork 405
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
Track boundary interaction #2736
Track boundary interaction #2736
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2736 +/- ##
==========================================
- Coverage 69.98% 69.38% -0.61%
==========================================
Files 196 196
Lines 15008 15033 +25
==========================================
- Hits 10503 10430 -73
- Misses 4505 4603 +98 ☔ View full report in Codecov by Sentry. |
*beep* *bop* 3 I001 [*] Import block is un-sorted or un-formatted
2 PIE790 [*] Unnecessary `pass` statement
2 D411 [*] Missing blank line before section ("Parameters")
2 UP004 [*] Class `RPacketLastInteractionTracker` inherits from `object`
1 ANN205 [ ] Missing return type annotation for staticmethod `get_relative_path`
1 B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
1 RET506 [ ] Unnecessary `else` after `raise` statement
Complete output(might be large): benchmarks/benchmark_base.py:29:9: ANN205 Missing return type annotation for staticmethod `get_relative_path`
benchmarks/benchmark_base.py:75:9: RET506 Unnecessary `else` after `raise` statement
tardis/transport/montecarlo/packet_trackers.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/packet_trackers.py:36:22: UP004 [*] Class `RPacketTracker` inherits from `object`
tardis/transport/montecarlo/packet_trackers.py:39:5: D411 [*] Missing blank line before section ("Parameters")
tardis/transport/montecarlo/packet_trackers.py:203:48: B009 [*] Do not call `getattr` with a constant attribute value. It is not any safer than normal property access.
tardis/transport/montecarlo/packet_trackers.py:223:37: UP004 [*] Class `RPacketLastInteractionTracker` inherits from `object`
tardis/transport/montecarlo/packet_trackers.py:226:5: D411 [*] Missing blank line before section ("Parameters")
tardis/transport/montecarlo/packet_trackers.py:268:9: PIE790 [*] Unnecessary `pass` statement
tardis/transport/montecarlo/packet_trackers.py:275:9: PIE790 [*] Unnecessary `pass` statement
tardis/transport/montecarlo/single_packet_loop.py:1:1: I001 [*] Import block is un-sorted or un-formatted
tardis/transport/montecarlo/tests/test_rpacket_tracker.py:1:1: I001 [*] Import block is un-sorted or un-formatted
Found 12 errors.
[*] 10 fixable with the `--fix` option.
|
771a665
to
7506cac
Compare
The output currently looks like: rpacket_tracker = sim.transport.transport_state.rpacket_tracker rpacket_tracker[2].boundary_interaction
rpacket_tracker[2].boundary_interaction["interaction_id"]
rpacket_tracker[2].boundary_interaction["current_shell_id"]
rpacket_tracker[2].boundary_interaction["next_shell_id"]
|
@@ -85,6 +86,9 @@ def single_packet_loop( | |||
) | |||
|
|||
rpacket_tracker.track(r_packet) | |||
rpacket_tracker.track_boundary_interaction( | |||
PacketEjectaStatus.OUT_EJECTA, r_packet.current_shell_id |
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.
I think we should rename this @andrewfullard
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.
I would personally just add to the PacketStatus Enum rather than defining a new one
f5242e4
to
edd7f43
Compare
@wkerzendorf I have added track line interaction in this PR, to demonstrate how will the final tracker functionality might look like instead of creating a new PR. |
@wkerzendorf The output the tracker displays. rpacket_tracker[10].boundary_interaction
rpacket_tracker[10].line_interaction
We can also access the individual attributes, rpacket_tracker[10].line_interaction["interaction_id"]
rpacket_tracker[10].line_interaction["shell_id"]
rpacket_tracker[10].line_interaction["r"]
rpacket_tracker[10].line_interaction["in_nu"]
|
I have converted this PR to a draft. I have to add tests, but it still can be reviewed as tests are independent. |
self.event_id += 1 | ||
|
||
def track_line_interaction(self, r_packet): | ||
if self.num_line_interactions >= self.line_interaction_array_length: |
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.
I think this if
block, and the one in track_boundary_interaction
, may be better as a separate method that performs the array extension.
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.
Yes. That makes sense. I will look into it.
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.
Can they both be merged into a single extend
function?
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.
That would be ideal.
1a6c053
to
6811d77
Compare
self.num_interactions = 0 | ||
self.boundary_interactions_index = 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 If I keep the name num_boundary_interactions
it seems similar to the variable num_interactions
and can be used to obtain the number of boundary interactions whereas with the current name, it seems that it will only be used for array purposes. Should I rename it to num_boundary_interactions
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.
It will be used for indexing purposes - essentially all of the analysis will be done on the dataframes
""" | ||
|
||
def __init__(self, length): | ||
self.length = length |
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.
I removed this length variable, since If I kept this length, I would have to add another length variable for every track_interaction function.
why is black failing here? even though locally with the same version it says no reformat is required. @atharva-2001 |
|
6524edd
to
909b73c
Compare
Yeah. I checked the version and the file it says to reformat, I ran black on that file. |
I haven't even changed that file, black is suggesting. |
Can you rebase once? |
I did that just now. |
I will try replicating this in a while |
thanks. |
0ff14f5
to
8987037
Compare
To replicate the benchmarking error,I started with a new branch created from the upstream/master branch, I rerun the benchmark locally of every commit, I made. First, remove the length variable, then declare the boundary_interaction datatype, and then define the track_boundary_interaction function. The benchmark failed when I added the track_boundary_interaction so the issue is this function but I can't figure it out. @officialasishkumar @andrewfullard Can you help me figure out the problem with this function? |
… as RPacketTracker
7ee0314
to
699cd4e
Compare
📝 Description
Type: 🚀
feature
This PR implements the functionality of tracking boundary interactions. It currently aims to track boundary interaction info in the form of (current_shell_id, next_shell_id)
Depends on PR #2719