From 139d419a7454f917d55408d0ee01b3b73d16ed54 Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Mon, 25 Oct 2021 09:15:59 -0400 Subject: [PATCH 1/6] Change acis cmd_set to return tuple not list for consistency --- Chandra/cmd_states/cmd_states.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chandra/cmd_states/cmd_states.py b/Chandra/cmd_states/cmd_states.py index c48dacf..d15a66a 100644 --- a/Chandra/cmd_states/cmd_states.py +++ b/Chandra/cmd_states/cmd_states.py @@ -761,7 +761,7 @@ def manvr(*args): ) def acis(*args): - cmds = [dict(cmd='ACISPKT', tlmsid=tlmsid) for tlmsid in args] + cmds = tuple(dict(cmd='ACISPKT', tlmsid=tlmsid) for tlmsid in args) return cmds def aciscti(): From 2ab4ca25b56343970e0cb9429b6979ea92467d4e Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Mon, 25 Oct 2021 09:16:29 -0400 Subject: [PATCH 2/6] Add dith_on and dith_off cmd_sets + tests of all --- Chandra/cmd_states/cmd_states.py | 27 ++++++++-- Chandra/cmd_states/tests/test_cmd_sets.py | 66 +++++++++++++++++++++++ 2 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 Chandra/cmd_states/tests/test_cmd_sets.py diff --git a/Chandra/cmd_states/cmd_states.py b/Chandra/cmd_states/cmd_states.py index d15a66a..ee5d815 100644 --- a/Chandra/cmd_states/cmd_states.py +++ b/Chandra/cmd_states/cmd_states.py @@ -792,13 +792,32 @@ def scs107(): tlmsid='WSPOW00000'), ) - def nsm(): - return (dict(cmd='COMMAND_SW', - tlmsid='AONSMSAF'), + def dith_on(): + return (dict(dur=1.025), + dict(cmd='COMMAND_SW', + tlmsid='AOENDITH', + ) + ) + + def dith_off(): + return (dict(dur=1.025), + dict(cmd='COMMAND_SW', + tlmsid='AODSDITH', + ) ) + def nsm(): + nsm_cmd = dict(cmd='COMMAND_SW', + tlmsid='AONSMSAF') + out = ((nsm_cmd,) + + scs107() + + dith_off() + ) + return out + cmd_sets = dict(manvr=manvr, scs107=scs107, nsm=nsm, obsid=obsid, - acis=acis, aciscti=aciscti) + acis=acis, aciscti=aciscti, + dith_on=dith_on, dith_off=dith_off) return cmd_sets[name](*args) diff --git a/Chandra/cmd_states/tests/test_cmd_sets.py b/Chandra/cmd_states/tests/test_cmd_sets.py new file mode 100644 index 0000000..e43bf6f --- /dev/null +++ b/Chandra/cmd_states/tests/test_cmd_sets.py @@ -0,0 +1,66 @@ +# Licensed under a 3-clause BSD style license - see LICENSE.rst + +from Chandra.cmd_states import cmd_set + + +def test_cmd_sets1(): + cmds = cmd_set('scs107') + exp = ({'dur': 1.025}, + {'cmd': 'SIMTRANS', 'dur': 65.66, 'params': {'POS': -99616}}, + {'cmd': 'ACISPKT', 'dur': 1.025, 'tlmsid': 'AA00000000'}, + {'cmd': 'ACISPKT', 'dur': 10.25, 'tlmsid': 'AA00000000'}, + {'cmd': 'ACISPKT', 'tlmsid': 'WSPOW00000'}) + assert cmds == exp + + +def test_cmd_sets2(): + cmds = cmd_set('nsm') + exp = ({'cmd': 'COMMAND_SW', 'tlmsid': 'AONSMSAF'}, + {'dur': 1.025}, + {'cmd': 'SIMTRANS', 'dur': 65.66, 'params': {'POS': -99616}}, + {'cmd': 'ACISPKT', 'dur': 1.025, 'tlmsid': 'AA00000000'}, + {'cmd': 'ACISPKT', 'dur': 10.25, 'tlmsid': 'AA00000000'}, + {'cmd': 'ACISPKT', 'tlmsid': 'WSPOW00000'}, + {'dur': 1.025}, + {'cmd': 'COMMAND_SW', 'tlmsid': 'AODSDITH'}) + assert cmds == exp + + +def test_cmd_sets3(): + cmds = cmd_set('manvr', 0, 1, 0, 0) + exp = ({'cmd': 'COMMAND_SW', + 'dur': 0.25625, + 'msid': 'AONMMODE', + 'tlmsid': 'AONMMODE'}, + {'cmd': 'COMMAND_SW', 'dur': 4.1, 'msid': 'AONM2NPE', 'tlmsid': 'AONM2NPE'}, + {'cmd': 'MP_TARGQUAT', + 'dur': 5.894, + 'params': {'Q1': 0.0, 'Q2': 1.0, 'Q3': 0.0, 'Q4': 0.0}, + 'tlmsid': 'AOUPTARQ'}, + {'cmd': 'COMMAND_SW', 'msid': 'AOMANUVR', 'tlmsid': 'AOMANUVR'}) + assert cmds == exp + + +def test_cmd_sets4(): + cmds = cmd_set('obsid', 30000) + exp = ({'cmd': 'MP_OBSID', 'params': {'ID': 30000}},) + assert cmds == exp + + +def test_cmd_sets5(): + cmds = cmd_set('acis', 'XTZ0000005', 'WSPOW0CF3F') + exp = ({'cmd': 'ACISPKT', 'tlmsid': 'XTZ0000005'}, + {'cmd': 'ACISPKT', 'tlmsid': 'WSPOW0CF3F'}) + assert cmds == exp + + +def test_cmd_sets6(): + cmds = cmd_set('dith_on') + exp = ({'dur': 1.025}, {'cmd': 'COMMAND_SW', 'tlmsid': 'AOENDITH'}) + assert cmds == exp + + +def test_cmd_sets7(): + cmds = cmd_set('dith_off') + exp = ({'dur': 1.025}, {'cmd': 'COMMAND_SW', 'tlmsid': 'AODSDITH'}) + assert cmds == exp From 32ae1b79b86190c8561b129278ebe10f5665421f Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Wed, 27 Oct 2021 14:59:26 -0400 Subject: [PATCH 3/6] Update scs107 cmd set for ACIS 3-FEPs not 0-FEPs (SCS-106 change) --- Chandra/cmd_states/cmd_states.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chandra/cmd_states/cmd_states.py b/Chandra/cmd_states/cmd_states.py index ee5d815..c47147d 100644 --- a/Chandra/cmd_states/cmd_states.py +++ b/Chandra/cmd_states/cmd_states.py @@ -789,7 +789,7 @@ def scs107(): tlmsid='AA00000000', dur=10.25), dict(cmd='ACISPKT', - tlmsid='WSPOW00000'), + tlmsid='WSPOW0002A'), ) def dith_on(): From 8c47acae4ca56b1666bdb060604243de879a0b98 Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Wed, 27 Oct 2021 15:48:17 -0400 Subject: [PATCH 4/6] Fix tests for SCS106 change --- Chandra/cmd_states/tests/test_cmd_sets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Chandra/cmd_states/tests/test_cmd_sets.py b/Chandra/cmd_states/tests/test_cmd_sets.py index e43bf6f..3c9131c 100644 --- a/Chandra/cmd_states/tests/test_cmd_sets.py +++ b/Chandra/cmd_states/tests/test_cmd_sets.py @@ -9,7 +9,7 @@ def test_cmd_sets1(): {'cmd': 'SIMTRANS', 'dur': 65.66, 'params': {'POS': -99616}}, {'cmd': 'ACISPKT', 'dur': 1.025, 'tlmsid': 'AA00000000'}, {'cmd': 'ACISPKT', 'dur': 10.25, 'tlmsid': 'AA00000000'}, - {'cmd': 'ACISPKT', 'tlmsid': 'WSPOW00000'}) + {'cmd': 'ACISPKT', 'tlmsid': 'WSPOW0002A'}) assert cmds == exp @@ -20,7 +20,7 @@ def test_cmd_sets2(): {'cmd': 'SIMTRANS', 'dur': 65.66, 'params': {'POS': -99616}}, {'cmd': 'ACISPKT', 'dur': 1.025, 'tlmsid': 'AA00000000'}, {'cmd': 'ACISPKT', 'dur': 10.25, 'tlmsid': 'AA00000000'}, - {'cmd': 'ACISPKT', 'tlmsid': 'WSPOW00000'}, + {'cmd': 'ACISPKT', 'tlmsid': 'WSPOW0002A'}, {'dur': 1.025}, {'cmd': 'COMMAND_SW', 'tlmsid': 'AODSDITH'}) assert cmds == exp From b3afb281f9e21fa90664d2dabf1909f402b87840 Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Wed, 27 Oct 2021 15:56:54 -0400 Subject: [PATCH 5/6] Make test compatible with Ska2 --- Chandra/cmd_states/tests/test_cmd_sets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Chandra/cmd_states/tests/test_cmd_sets.py b/Chandra/cmd_states/tests/test_cmd_sets.py index 3c9131c..ebb3e63 100644 --- a/Chandra/cmd_states/tests/test_cmd_sets.py +++ b/Chandra/cmd_states/tests/test_cmd_sets.py @@ -27,7 +27,7 @@ def test_cmd_sets2(): def test_cmd_sets3(): - cmds = cmd_set('manvr', 0, 1, 0, 0) + cmds = cmd_set('manvr', 0, 0, 0, 1) exp = ({'cmd': 'COMMAND_SW', 'dur': 0.25625, 'msid': 'AONMMODE', @@ -35,7 +35,7 @@ def test_cmd_sets3(): {'cmd': 'COMMAND_SW', 'dur': 4.1, 'msid': 'AONM2NPE', 'tlmsid': 'AONM2NPE'}, {'cmd': 'MP_TARGQUAT', 'dur': 5.894, - 'params': {'Q1': 0.0, 'Q2': 1.0, 'Q3': 0.0, 'Q4': 0.0}, + 'params': {'Q1': 0.0, 'Q2': 0.0, 'Q3': 0.0, 'Q4': 1.0}, 'tlmsid': 'AOUPTARQ'}, {'cmd': 'COMMAND_SW', 'msid': 'AOMANUVR', 'tlmsid': 'AOMANUVR'}) assert cmds == exp From f9b30cb944fdb92b8b4489a2061151bef19271c4 Mon Sep 17 00:00:00 2001 From: Tom Aldcroft Date: Wed, 27 Oct 2021 16:29:23 -0400 Subject: [PATCH 6/6] Add RADMON disable and Fid light reset --- Chandra/cmd_states/cmd_states.py | 7 +++++++ Chandra/cmd_states/tests/test_cmd_sets.py | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/Chandra/cmd_states/cmd_states.py b/Chandra/cmd_states/cmd_states.py index c47147d..2632e3e 100644 --- a/Chandra/cmd_states/cmd_states.py +++ b/Chandra/cmd_states/cmd_states.py @@ -779,6 +779,13 @@ def aciscti(): def scs107(): return (dict(dur=1.025), + dict(cmd='COMMAND_SW', + dur=1.025, + tlmsid='OORMPDS'), + dict(cmd='COMMAND_HW', + dur=1.025, + tlmsid='AFIDP', + msid='AFLCRSET'), dict(cmd='SIMTRANS', params=dict(POS=-99616), dur=65.66), diff --git a/Chandra/cmd_states/tests/test_cmd_sets.py b/Chandra/cmd_states/tests/test_cmd_sets.py index ebb3e63..9382c22 100644 --- a/Chandra/cmd_states/tests/test_cmd_sets.py +++ b/Chandra/cmd_states/tests/test_cmd_sets.py @@ -2,10 +2,13 @@ from Chandra.cmd_states import cmd_set +# COMMAND_HW | TLMSID= AFIDP, HEX= 6480005, MSID= AFLCRSET def test_cmd_sets1(): cmds = cmd_set('scs107') exp = ({'dur': 1.025}, + {'cmd': 'COMMAND_SW', 'dur': 1.025, 'tlmsid': 'OORMPDS'}, + {'cmd': 'COMMAND_HW', 'dur': 1.025, 'tlmsid': 'AFIDP', 'msid': 'AFLCRSET'}, {'cmd': 'SIMTRANS', 'dur': 65.66, 'params': {'POS': -99616}}, {'cmd': 'ACISPKT', 'dur': 1.025, 'tlmsid': 'AA00000000'}, {'cmd': 'ACISPKT', 'dur': 10.25, 'tlmsid': 'AA00000000'}, @@ -17,6 +20,8 @@ def test_cmd_sets2(): cmds = cmd_set('nsm') exp = ({'cmd': 'COMMAND_SW', 'tlmsid': 'AONSMSAF'}, {'dur': 1.025}, + {'cmd': 'COMMAND_SW', 'dur': 1.025, 'tlmsid': 'OORMPDS'}, + {'cmd': 'COMMAND_HW', 'dur': 1.025, 'tlmsid': 'AFIDP', 'msid': 'AFLCRSET'}, {'cmd': 'SIMTRANS', 'dur': 65.66, 'params': {'POS': -99616}}, {'cmd': 'ACISPKT', 'dur': 1.025, 'tlmsid': 'AA00000000'}, {'cmd': 'ACISPKT', 'dur': 10.25, 'tlmsid': 'AA00000000'},