-
Notifications
You must be signed in to change notification settings - Fork 78
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
Set the default timestamps in config file #259
Set the default timestamps in config file #259
Conversation
- Add the timestamp_pointing variable in the standard config file - Use the timestamps set in the config file for poinintg interpolation
Thanks @morcuended! |
Yes, that's it Commenting it with @labsaha we realized that probably is better to define three variables in the config file like:
because one might not know the names of the variables (
What do you think @rlopezcoto? |
I think it is a good idea, but I also see it a bit dangerous because if more than one of the variables are set as |
I agree with @rlopezcoto here. The general question is "should the standard config file be exhaustive about the options?" (note that this question is not limited to the option at hand here) ps: I would personally keep the current impementation, but it's as you prefer, both options have their flaws. |
event_timestamps = dragon_time | ||
elif config['timestamps_pointing'] == "tib": | ||
event_timestamps = tib_time | ||
|
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.
else:
raise ValueError("the timestamps_pointing option is not a valid one")
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.
Thanks, @vuillaut!
The error should be raised whenever there is more than one timestamp option set as true, right? So first we have to check this.
We were thinking of rather creating a timestamps_pointing dictionary within config file. It would look like this:
"timestamps_pointing":{
"ucts": true
"dragon": false
"tib": false
}
and check whether there is more than one true element with something like this:
list(filter(config["timestamps_pointing"].get, config["timestamps_pointing"]))
So it would be:
if len(list(filter(config["timestamps_pointing"].get,
config["timestamps_pointing"]))) > 1:
raise ValueError("the timestamps_pointing option is not a valid one")
But it's quite the opposite of explicit. What do you think?
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.
else: raise ValueError("the timestamps_pointing option is not a valid one")
OK, I didn't quite understand yesterday when I saw it first. Now I also prefer the first implementation with the addition of these (else & raise) lines. Makes the code clearer. With the second implementation, it wouldn't be so clear how to raise the error, because it has to be checked whether there is only one true option or not.
ok, everything looks good now, thanks @morcuended and @vuillaut! If nobody else opposes, I'll also merge |
In order to be able to use any of the three available timestamps for pointing interpolation, I propose these changes (suggested by @rlopezcoto). I do not know if the nomenclature is the most convenient or not.
timestamps_pointing
variable in the standard config fileucts
,dragon
ortib
) for pointing interpolation instead of having one of them hardcoded.In this way, it will be possible to analyze old data using the required timestamps without having to change the code each time.