-
Notifications
You must be signed in to change notification settings - Fork 8
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
channelmap updates #78
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #78 +/- ##
===========================================
- Coverage 71.95% 56.33% -15.62%
===========================================
Files 8 8
Lines 813 497 -316
===========================================
- Hits 585 280 -305
+ Misses 228 217 -11 ☔ View full report in Codecov by Sentry. |
Is it worth having the error instead be the current behaviour and a warning this behaviour is going to change in the future, conscious many people probably have code that calls this, not sure if better just to break it or not? |
Yeah, that makes sense, I've changed this to a deprecation warning message |
|
||
try: | ||
pd, run = re.fullmatch("([pP][0-9]+)\\s*([rR][0-9]+)", on).group(1, 2) | ||
runinfo = self.dataprod.runinfo[pd][run] |
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.
Will this generate an understandable error message if the string does not match?
system = "all" | ||
|
||
if system is None: | ||
msg = "Use of channelmap with an on arg but no system arg is deprecated and will raise an error in the future. Provide a value (e.g. 'all', 'cal', 'phy', etc.)" |
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.
msg = "Use of channelmap with an on arg but no system arg is deprecated and will raise an error in the future. Provide a value (e.g. 'all', 'cal', 'phy', etc.)" | |
msg = ( | |
"Use of channelmap with an on arg but no system arg is " | |
"deprecated and will raise an error in the future. Provide " | |
"a value (e.g. 'all', 'cal', 'phy', etc.)" | |
) |
|
||
if system is None: | ||
msg = "Use of channelmap with an on arg but no system arg is deprecated and will raise an error in the future. Provide a value (e.g. 'all', 'cal', 'phy', etc.)" | ||
log.warning(msg) |
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.
log.warning(msg) | |
import warnings | |
warnings.warn(msg, DeprecationWarning, stacklevel=2) |
|
||
>>> channel = lmeta.channelmap(on=datetime.now(), system='cal').V05267B | ||
|
||
>>> channel = lmeta.channelmap('p08 r005', system='cal').V05267B |
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.
>>> channel = lmeta.channelmap(on=datetime.now(), system='cal').V05267B | |
>>> channel = lmeta.channelmap('p08 r005', system='cal').V05267B | |
>>> channel = lmeta.channelmap(on=datetime.now(), system='cal').V05267B | |
>>> channel = lmeta.channelmap('p08 r005', system='cal').V05267B |
Updated behavior of channelmap arguments
on
argument is provided, asystem
argument must be provided or an error will be thrown. If noon
is provided default to"all"
. This has the goal of avoiding confusion/ambiguity caused by the"all"
default. See Unexpected behavior for channel map system #76on
can provide period and run instead of just a timestamp. This will use the runinfo database to look up the timestamp. This is just a mild QoL improvement to interfacing with it.