-
Notifications
You must be signed in to change notification settings - Fork 101
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
OLD: Improve JUMP objects #1072
base: master
Are you sure you want to change the base?
Conversation
I'm really unclear on what |
Codecov Report
@@ Coverage Diff @@
## master #1072 +/- ##
==========================================
+ Coverage 60.83% 61.05% +0.22%
==========================================
Files 86 86
Lines 18744 18707 -37
Branches 3150 3134 -16
==========================================
+ Hits 11402 11422 +20
+ Misses 6615 6555 -60
- Partials 727 730 +3
Continue to review full report at Codecov.
|
Some of the |
I don't really know what you mean - there are only two kinds of JUMPs:
As far as I can tell |
You seem to wind up with tim files like:
and there isn't a way to JUMP all the TOAs that have |
I think @champagne-cmd might want to chime in on this discussion. |
The reason for the list containing quoted numbers not just numbers is that we use string in the maskParameter key-values to prevent confusion in the case of when the key-value is "430", which means 430MHz backend. |
Flag values can only contain strings when they come out of tim files, so storing a list in there at all is going to be a problem. But in any case the "430" backend string never occurs in a list, and what confusion would arise if the list contained integers? |
@aarchiba As mentioned in that PR, the |
The reason to have a list is to handle the case like "JUMP -mjd 54000 55000". But I can see that we can change "key_value=[54000, 55000] " to key_value1 = 54000, key_value2 = 55000 |
And in the past, interactively handled JUMPs set from |
The main reason there is a list is so that a single TOA can be associated with multiple different JUMPs. |
The way that |
I think it's a bad idea to add flags to TOAs objects that won't survive the round trip to tim files. And if these jump flags are useful (for what? I still don't know) why would you not save them in tim files? If they're meant to be ephemeral and have a different data type from what's in the tim file, what are they doing in the |
Let me elaborate on that point a little: The |
|
My basic question is: why is it desired to have a flag on each TOA that lists which JUMPs affect it? for j in model.jumps:
toa_indices = getattr(model, j).select_toa_mask(toas)
if my_toa_index in toa_indices:
print(f"TOA {my_toa_index} is affected by jump {j}") |
I'm not sure that's the right question, @aarchiba. We need a way to select TOAs that are JUMPed based on the presence or value of a generic flag. That's a requirement because it is something that TEMPO2 users use. Given that we have to do that, and also that we need to support .tim-file JUMPs which need to be assigned to each TOA as they are read, it made sense to use flags for other kinds of JUMPs (like likely temporary ones from interactive use in Note that we do not have what your question seems to be asking: we do not make a single flag and assign to it every single JUMP that affects that TOA. Nor do we desire such a thing. The big issue, and it was the one that came up for #1032, was how do we assign more than one of the same type of JUMPs to the same TOA interactively? We decided to use a list, because we never even considered that someone would want to write those JUMPs out into a Note: I still think that we should require that that |
We have that.
Currently when we load TOAs with JUMP blocks, those JUMP blocks are assigned numbers and the affected TOAs get a flag The easiest way to implement GUI jumps is to add a flag
How about, if you want two different subsets for two different GUI jumps,
I've got a PR under development that ensures we deal with strings in the flags column. |
I think the But please, once again, be gentle with these discussions? The code that we have has been written by numerous students over the years -- and a lot of this discussion is on stuff that was done only a few months ago! There are zillions of ways to implement these things and the use cases can be really confusing (and different people value certain things over others). |
One important thing to remember about a use case is that in |
JUMP indices can and should be ignored. They play no role at all in which TOAs the JUMPs match; they exist only to give all JUMPs distinct names in the model. They can and should be replaced so that JUMPs get named something like JUMP_flag_value. Unfortunately, because they define the user-visible name of the parameter from python, the current naming scheme, and the fragile numeration, have gotten baked into places like the NANOGrav yaml files and the I started writing code to abolish JUMP indices but the current model builder does something arcane with them and I don't want to go digging in there as it is about to be replaced. |
To get all the JUMPs as model params, you can use To get all the TOAs affected by a jump you can use To get all the JUMPs affecting a TOA, you can write a loop like the one I wrote above. (The current alternative method to do this requires writing a loop to iterate over all sets of TOA flags and asking whether the index of the current JUMP is in that list.) The current functions do not work. I loaded in some TOAs with two JUMP blocks, whose TOAs got corresponding |
I haven't followed all this but if the problem is just numbering jumps, why not change things like GUI jumps and old style TIM file jumps to use a hash key, which is (essentially) unique and doesn't require any kind of sequence? Those can be assigned without care about how many jumps there already are, and can be written/read to TIM files. |
JUMP numbers need to go away permanently. We should not have parameters called JUMP17. There's a separate question, of if (say) pintk wants to use two different GUI jumps, how it should name the associated flags and values; I am agnostic on this but there's no reason pintk can't just keep its own internal list of numbers for its GUI jumps. |
Hey everyone, To answer your question @aarchiba , the jumps are all given the 'jump' flag because, as @scottransom mentioned earlier, pintk uses the flags to find where the jumps are in the TOAs. I believe this design was chosen so that, if you just have a portion of the TOAs chosen in pintk that you are fitting to or performing some other operation on, you could simply iterate over that portion's flags and easily see what jumps are in your selection/if they are all jumped/etc - using the TOA indices that we have on-hand to find the jumps as opposed to iterating through the jumps to see if we come across a selected TOA index. But using select_toa_mask may be better to avoid using confusing flags to track this. I can start this transition next and see if I come across any pitfalls. I was also planning to transition the gui/tim jump key_values to a randomized hex instead of the jump index, but if you've already started on that @aarchiba I can hold off on that. |
I can remove the |
Just to check, though: one goal of pintk is to allow multiple GUI jumps simultaneously, right? Is there any interest in these being able to overlap? If no overlaps are needed, I suggest using the flag My approach to these would be that pintk would have a list of GUI jumps that it was currently managing, and this list would include the flag and value associated with each one. This list could even just be "all JUMPs whose flag starts with |
See #1074 where I've tried to make flag manipulation much more convenient. |
Highlight JUMPed TOAs (if JUMP unfrozen). Document pintk module (include pointers to plk and pulsar). Label JUMPs and test new code
fe543ad
to
4552ef4
Compare
@aarchiba I saw your request in the PINT Slack channel to take a look at this PR. I'm happy to do that and hopefully get it a thumbs-up. But why did it get changed to "HOLD"? |
I just tried to play with this using
|
I also tried adding this line to NGC6440E.par:
and then just starting pintk immediately triggered that same exception. |
As I said in the edited initial description, this changes the API in a way that would force an update of timing_analysis and after discussing it with Joe Swiggum I don't want to do that while we're working on v1.0. Please still feel free to review it but I think we should hold off on merging it for now. |
Ah, this is obviously some kind of pintk summary code that isn't part of the test suite. This PR changes the name of the selection attributes from |
I just used
|
No need for this to be on hold any more; when I have time to work on it I'll fix the conflicts and make the changes suggested. |
|
||
from pint.models.parameter import maskParameter | ||
from pint.models.timing_model import DelayComponent, MissingParameter, PhaseComponent | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class DelayJump(DelayComponent): |
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.
Tempo actually has delay jumps for the observatory cable delays. I was thinking to switch the backend jump to delay jump. The jump value affects the binary delay calculation.
This PR needs to rebase and fix the conflict. |
This PR is meant to clarify the behaviour of JUMPs in PINT, and to ensure that they behave as expected in cases like overlapping JUMPs. This clarification has forced some changes affecting pintk. There are now some tests of pintk's Pulsar wrapper.
This has some minor API changes that would require updates from NANOGrav's
timing_analysis
to match, which we don't want to do before about 2021 Sept 10 because v1.0 is in active development. Testing is still very welcome, but please don't merge this until v1.0 is ready.Closes #1078
2022 July 6: This may need very substantial updating to match the current state of the code. It is probably better to pull code and documentation snippets from this into a new PR. I do think a PR to do these same things would be a good idea.