sot / kadi

Chandra commands and events
https://sot.github.io/kadi
BSD 3-Clause "New" or "Revised" License
5 stars 3 forks source link

How to build dynamic states from continuity and oflsdir backstop? #130

Closed jeanconn closed 5 years ago

jeanconn commented 5 years ago

What is the recommended path to work from dynamic states to run thermal models?

I assume that we want something similar to the cmd_states approach where we get:

And then from the initial state and the commands from the commands table and the commands in the under-evaluation backstop we make states. I just don't immediately see how to extract commands from the backstop in products and combine those with the commands from kadi.commands.commands.get_cmds and feed everything to kadi.commands.get_states .

Specifically I was wondering about moving starcheck to dynamic states as part of the fix for

https://github.com/sot/starcheck/issues/219

taldcroft commented 5 years ago

Ihink this is addressed in the Note in this section:

http://cxc.cfa.harvard.edu/mta/ASPECT/tool_doc/kadi/commands_states.html#states-from-commands

Does that do it?

taldcroft commented 5 years ago

Oops, I see in there reference to a magical method add_comands() that is "not yet implemented". Err. Probably not too hard?

jeanconn commented 5 years ago

Yes, I was just writing that back. I had forgotten that part of the docs (so that was helpful) and if we still need to implement that command to make that work, that looks like the way to go forward! Probably not too hard as you say.

taldcroft commented 5 years ago

I have a POC implementation on my laptop. Need to step away for a meeting and other stuff, stand by.

jeanconn commented 5 years ago

OK. I was back on yoshi work. I figured that it would be good to keep the ball moving on starcheck improvements, but the eclipses overall are a small effect (which is why this didn't bump up to a high priority issue earlier).

taldcroft commented 5 years ago

For the record, this might work:

def add_bs_to_cmds(cmds, bs):
    n_bs = len(bs)
    out = CommandTable()
    out['idx'] = np.zeros(n_bs, dtype=np.uint16)
    out['date'] = np.chararray.encode(bs['date'])
    out['type'] = np.chararray.encode(bs['type'])
    out['tlmsid'] = np.chararray.encode(bs['tlmsid'])
    out['scs'] = bs['scs']
    out['step'] = bs['step']
    out['timeline_id'] = 0
    out['vcdu'] = bs['vcdu']
    out['params'] = bs['params']

    cmds_plus_bs = vstack([cmds, out])
    cmds_plus_bs.sort(['date', 'step', 'scs'])

    return cmds_plus_bs