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

Use RLTT and schedule_stop in thermal calculation #344

Merged
merged 7 commits into from
May 18, 2020
Merged

Use RLTT and schedule_stop in thermal calculation #344

merged 7 commits into from
May 18, 2020

Conversation

taldcroft
Copy link
Member

@taldcroft taldcroft commented Apr 30, 2020

Description

This jumps off from #341 and implements the suggestions there, and then makes a number of changes so I could test this. Requires sot/kadi#164.

Testing

  • Passes unit tests on linux (regression test weeks were run and pass)
  • Functional testing

Fixes #340
Fixes #62

Functional testing

Used this script:

import os
from pathlib import Path

from starcheck.calc_ccd_temps import get_ccd_temps

SKA = Path(os.environ['SKA'])
oflsdir = str(SKA / 'data/mpcrit1/mplogs/2020/APR3020/oflsa')
oflsdir2 = str(SKA / 'data/mpcrit1/mplogs/2020/JAN1320/oflsa')

get_ccd_temps(oflsdir,
              outdir='out1')

get_ccd_temps(oflsdir,
              outdir='out2',
              run_start_time='2020:117:00:00:00')

get_ccd_temps(oflsdir,
              outdir='out3',
              run_start_time='2020:118:00:00:00',
              test_rltt='2020:119:00:00:00',
              test_sched_stop='2020:128:00:00:00')

get_ccd_temps(oflsdir2,
              outdir='out4')

Outputs

#####################################################################
# calc_ccd_temps run at Thu Apr 30 19:02:27 2020 by None
# Continuity run_start_time = 2020:121:23:02:27.761
# calc_ccd_temps version = 13.5.2.dev10+ge94bb8c.d20200430
# kadi version = 5.1.1.dev3+g8f962da.d20200430
#####################################################################

Using backstop file /Users/aldcroft/ska/data/mpcrit1/mplogs/2020/APR3020/oflsa/CR121_1505.backstop
Found 770 backstop commands between 2020:121:13:45:01.542 and 2020:124:23:46:08.591
RLTT = 2020:121:13:45:01.542
sched_stop = 2020:124:23:46:08.591
Fetching telemetry between 2020:120:01:26:31.325 and 2020:121:01:26:31.325
Calculating ACA thermal model
Propagation initial time and ACA: 2020:121:01:10:46.816 -9.94
Making temperature check plots
Writing plot file out1/ccd_temperature.png

image

#####################################################################
# calc_ccd_temps run at Thu Apr 30 19:02:30 2020 by None
# Continuity run_start_time = 2020:117:00:00:00.000
# calc_ccd_temps version = 13.5.2.dev10+ge94bb8c.d20200430
# kadi version = 5.1.1.dev3+g8f962da.d20200430
#####################################################################

Using backstop file /Users/aldcroft/ska/data/mpcrit1/mplogs/2020/APR3020/oflsa/CR121_1505.backstop
Found 770 backstop commands between 2020:121:13:45:01.542 and 2020:124:23:46:08.591
RLTT = 2020:121:13:45:01.542
sched_stop = 2020:124:23:46:08.591
Fetching telemetry between 2020:116:00:00:00.000 and 2020:117:00:00:00.000
Calculating ACA thermal model
Propagation initial time and ACA: 2020:116:23:46:54.816 -9.13
Making temperature check plots
Writing plot file out2/ccd_temperature.png

image

#####################################################################
# calc_ccd_temps run at Thu Apr 30 19:02:32 2020 by None
# Continuity run_start_time = 2020:118:00:00:00.000
# calc_ccd_temps version = 13.5.2.dev10+ge94bb8c.d20200430
# kadi version = 5.1.1.dev3+g8f962da.d20200430
#####################################################################

Using backstop file /Users/aldcroft/ska/data/mpcrit1/mplogs/2020/APR3020/oflsa/CR121_1505.backstop
Found 770 backstop commands between 2020:121:13:45:01.542 and 2020:124:23:46:08.591
RLTT = 2020:119:00:00:00.000
sched_stop = 2020:128:00:00:00.000
Fetching telemetry between 2020:117:00:00:00.000 and 2020:118:00:00:00.000
Calculating ACA thermal model
Propagation initial time and ACA: 2020:117:23:44:38.816 -9.49
Making temperature check plots
Writing plot file out3/ccd_temperature.png

image

#####################################################################
# calc_ccd_temps run at Thu Apr 30 19:02:34 2020 by None
# Continuity run_start_time = 2020:121:23:02:34.551
# calc_ccd_temps version = 13.5.2.dev10+ge94bb8c.d20200430
# kadi version = 5.1.1.dev3+g8f962da.d20200430
#####################################################################

Using backstop file /Users/aldcroft/ska/data/mpcrit1/mplogs/2020/JAN1320/oflsa/CR011_2305.backstop
Found 1517 backstop commands between 2020:011:23:35:32.624 and 2020:019:13:36:43.899
RLTT = 2020:011:23:35:32.624
sched_stop = 2020:019:13:36:43.899
Fetching telemetry between 2020:010:23:35:32.624 and 2020:011:23:35:32.624
Calculating ACA thermal model
Propagation initial time and ACA: 2020:011:23:22:30.816 -8.39
Making temperature check plots
Writing plot file out4/ccd_temperature.png

image

# If the last obsid interval extends over the end of states then
# extend the state / predictions.
last_state = states[-1]
last_sc_obsid = sc_obsids[-1]
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand the circumstances where starcheck would make an obsid interval that extends beyond the end of commanding. With SCHEDULED_STOP in backstop this bit is not needed, but wondering if it is needed for regression testing or whatnot.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC in the absence of something useful like SCHEDULED_STOP, if the schedule ended in NPNT (and had no maneuver in backstop to define end time), the obsid stop time for the last observation in the schedule was sometimes set from the stop time listed in the processing summary? Maybe?

I remember spending a lot of time on corner cases to get it to not just fail out. Should be moot if we can do a modern hopper transition and better state building but there you go.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added your text as a comment to the code for our future selves.

@jeanconn
Copy link
Contributor

jeanconn commented May 1, 2020

Looks like you've also closed #62 for testing.


if json_obsids is None:
# Only happens in testing, so use existing obsids file in OFLS dir
json_obsids = Path(oflsdir, 'starcheck', 'obsids.json').read_text()
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose if one uses a local oflsdir one would not need to presume that the tested changes in local starcheck weren't causing diffs in the obsids.json.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand this.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we were to change something about the timing of the obsids (saved in that obsids.json file) with a change in starcheck, the new 'test code' here in calc_ccd_temps.py probably wouldn't get the right answer to test a new starhceck release candidate if you use /data/mpcrit1/mplogs oflsdirs for input. I think I was saying, that your test fixes in calc_ccd_temps.py are great but they don't solve all integration testing issues with the Perl pieces of starcheck.pl.

@jeanconn
Copy link
Contributor

jeanconn commented May 4, 2020

This looks good to me and I ran the regression weeks... but I need to go over the outputs a bit.

@taldcroft
Copy link
Member Author

but I need to go over the outputs a bit.

Any progress there? Would be good to get this merged before we've forgotten everything and have to re-review from scratch.

@jeanconn
Copy link
Contributor

Not really. I think I just want to rerun the regression outputs just for this change and confirm there are just no changes. I should be able to wrap that up today. Is the issue with timeliness on merging or promoting? I figured this could probably go next week but I don't know if you are done with kadi and/or if we wanted another skare3 release before the namespace one.

@taldcroft
Copy link
Member Author

It's just merging. I got behind on reviewing PR's but in general am striving to avoid old-but-active PRs in our work.

@jeanconn
Copy link
Contributor

And I'm not done with review. I still don't quite understand changes in the calculated ACA temperatures in the regression loads (as they do not have RLTT or schedule stop). They are small changes but I'm not clear about which piece is introducing them.


# Add in the backstop commands
cmds = cmds.add_cmds(bs_cmds)

# Get the states for available commands. This automatically gets continuity.
state_keys = ['obsid', 'pitch', 'q1', 'q2', 'q3', 'q4', 'eclipse']
states = kadi_states.get_states(cmds=cmds, state_keys=state_keys,
merge_identical=True)
states = kadi_states.get_states(cmds=cmds, start=init_tlm_time, stop=sched_stop,
Copy link
Contributor

@jeanconn jeanconn May 15, 2020

Choose a reason for hiding this comment

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

I had been thinking of the get_states changes as just a convenience. Here, now that start is passed, it looks like the first returned state in the (propagation interval of the) test load I'm viewing (JAN117A), now starts 15 minutes earlier at init_tlm_time instead of the time of cmds[0]. I think that is totally fine for starcheck's thermal model but I wasn't expecting the change.

Copy link
Member Author

Choose a reason for hiding this comment

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

More than fine, it is now correct. Previously the propagation temperature from available telemetry was being applied starting at the wrong time. In most circumstances it didn't really matter, but it is theoretically possible that the first command could be many hours after init_tlm_time, e.g. during a long observation between comms.

Copy link
Contributor

Choose a reason for hiding this comment

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

That was my thinking as well (that it is more correct), though I figured it was worth calling out in discussion in the PR as it is a functional change that was not mentioned in the PR top matter.

Copy link
Contributor

@jeanconn jeanconn left a comment

Choose a reason for hiding this comment

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

I'm good with this, with the understanding that the constructed states for propagation now start at init_tlm_time instead of, what, the first command after init_tlm_time? Seems reasonable.

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.

Use RUNNING_LOAD_TERMINATION_TIME for ACA thermal propagation calc_ccd_temps tool is no longer stand-alone
2 participants