Skip to content
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

Allow CALC_ prefix as an alias for DP_ #227

Merged
merged 4 commits into from
Mar 16, 2022
Merged

Allow CALC_ prefix as an alias for DP_ #227

merged 4 commits into from
Mar 16, 2022

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Mar 9, 2022

Description

MAUDE uses the prefix CALC_ to indicate pseudo-MSIDs that are calculated from actual spacecraft MSIDs, for example CALC_ROLL_FSS. Cheta uses DP_ for the same meaning, and many calcs have the same name apart from CALC_ vs DP_. The good news is that MAUDE also accepts DP_ as a prefix.

This PR does a simple translation of CALC_ to DP_ in input MSIDs to enable interoperability. This is especially useful for a query that uses both CXC and MAUDE for the backend data source. This translation is seen in self.MSID (backend query version) but not in self.msid (user-supplied version).

Finally, the plot method was updated to use an upper-cased version of the user-supplied MSID. So if the user asks for calc_pitch_fss then they see CALC_PITCH_FSS in the plot title, while pitch_fss goes to PITCH_FSS. In both cases the internal self.MSID would be DP_PITCH_FSS since that is what is used in the backend query.

This requires https://github.com/sot/maude/pull/39

Interface impact

The interface now allows MSIDs with a prefix of CALC_.

The title in plots made from an MSID object has been changed. Previously it included self.MSID which is
the internal version used to actually fetch telemetry data. Now it is self.msid.upper(), which is an upper-cased version of the MSID specified by the user in the query. For instance if you did dat = fetch.Msid('pitch_fss', ...), previously the plot title was DP_PITCH_FSS but now it will be PITCH_FSS.

Testing

  • Passes unit tests on MacOS (with new unit test)
  • Functional testing

Functional testing

Made the following plots to confirm the update to the plot title.

In [2]: dat = fetch.Msid('calc_pitch_fss', CxoTime.now() - 3)
In [3]: dat.plot()
In [4]: dat.iplot()

In [5]: dat = fetch.Msid('calc_pitch_fss', CxoTime.now() - 3, stat='5min')
In [6]: dat.plot()
In [7]: dat.iplot()

In [8]: dat = fetch.Msid('calc_pitch_fss', CxoTime.now() - 30, stat='5min')
In [9]: dat.iplot()

Copy link
Contributor

@javierggt javierggt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks simple enough to me.

dat3 = fetch.Msid('pitch', '2020:001', '2020:002')
for d1, d2 in ((dat1, dat2), (dat1, dat3)):
assert np.all(d1.times == d2.times)
assert np.all(d1.vals == d2.vals)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you care that the MSID changes? in other words:
d1.MSID == d2.MSID is True as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that change in the MSID from what the user provides was annoying me. The problem is that fixing that requires handling the different prefixes at a lower level in the code. So in the end I went for "perfect is the enemy of good" here.

I think that if you provide a single MSID (i.e. not a glob) then d1.msid will reflect what you provided.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no issues with it changing as long as one knows and perhaps documented, I just checked that it does change:

In [1]: from cheta import fetch

In [2]: dat1 = fetch.Msid('calc_pitch', '2020:001', '2020:002')

In [3]: dat1.msid
Out[3]: 'DP_pitch'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if one is going to change it, perhaps it should be "normalized", meaning that the name is always the same for a given msid.

@taldcroft
Copy link
Member Author

@javierggt - I think I addressed your concerns and made this a little better. The input msid is always left unchanged (when there is no fileglob *), and this user value is reflected in the plot title.

@taldcroft taldcroft requested a review from jeanconn March 14, 2022 13:30
@taldcroft
Copy link
Member Author

@javierggt @jeanconn - ping that this is ready for review and I addressed the initial comments.

@taldcroft taldcroft requested a review from javierggt March 14, 2022 13:31
@taldcroft taldcroft merged commit 82f4fd0 into master Mar 16, 2022
@taldcroft taldcroft deleted the allow-calc-prefix branch March 16, 2022 13:50
@javierggt javierggt mentioned this pull request Mar 30, 2022
@javierggt javierggt mentioned this pull request Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants