def test_cell_equality(): cell = stypes.Cell_Int(8) assert cell == [] spice.appndi(1, cell) spice.appndi(2, cell) spice.appndi(3, cell) assert not cell == [] assert not cell == [1] assert not cell == [1, 2] assert cell == [1, 2, 3] assert not cell == [1, 2, 3, 4] celld = stypes.Cell_Double(8) spice.appndd(1.1, celld) spice.appndd(2.2, celld) spice.appndd(3.3, celld) assert celld == [1.1, 2.2, 3.3] assert not celld == cell
for arg in sys.argv: spice.furnsh(arg) # Get pairs of ET endpoints from kernel pool pts = list(spice.gdpool('PAIR_TIMES', 0, 100)) nPETs = len(pts) # Set or clear debug flag try: doDebug = True if spice.gcpool("DEBUG", 0, 1, 999)[0] else False except: doDebug = False # Allocate cell of SpiceDoubles pws = stypes.SPICEDOUBLE_CELL(nPETs) # Add ET endpoints to cell pts.reverse() while pts: spice.appndd(pts.pop(), pws) # Convert those pairs of ET endpoints into confinement window pws = spice.wnvald(nPETs, nPETs, pws) assert (spice.wncard(pws) << 1) == nPETs pts = list(spice.gdpool('PAIR_TIMES', 0, 100)) # Get the filename of, and read, the input XFR file filename = spice.gcpool("XPC_KERNEL", 0, 1, 999)[0] assert filename # Read transfer file as XpcFile object xpcFileIn = XpcFile(fnIn=filename) if doDebug: import pprint pprint.pprint((vars(xpcFileIn), vars(xpcFileIn.segments[0]))) # Slice read XpcFile object per confinement window xpcFileOut = xpcFileIn.slice(pws) if doDebug:
def test_Cell_Double(): cell = stypes.Cell_Double(8) spice.appndd(1.1, cell) spice.appndd(2.2, cell) spice.appndd(3.3, cell) assert [x for x in cell] == [1.1, 2.2, 3.3]
spice.furnsh(sd.pck00010) sc = SC({ 'date0': '2021-03-03 22:10:35 TDB', 'coes': [7480.0, 0.09, 5.5, 6.26, 5.95, 0.2], 'tspan': '40', }) st.write_bsp(sc.ets, sc.states[:, :6], {'bsp_fn': 'leo.bsp'}) spice.furnsh('leo.bsp') et0 = spice.str2et('2021-03-03 22:10:40 TDB') etf = spice.str2et('2021-03-04 TDB') timecell = spice.utils.support_types.SPICEDOUBLE_CELL(2) spice.appndd(et0, timecell) spice.appndd(etf, timecell) cell = spice.gfoclt('ANY', '399', 'ELLIPSOID', 'IAU_EARTH', '10', 'ELLIPSOID', 'IAU_SUN', 'LT', '-999', 120.0, timecell) ets_SPICE = spice.wnfetd(cell, 0) cal0 = spice.et2utc(ets_SPICE[0], 'C', 1) cal1 = spice.et2utc(ets_SPICE[1], 'C', 1) print('\n*** SPICE RESULTS ***') print(f'{cal0} --> {cal1}') sc.plot_3d() sc.calc_eclipses(vv=True) sc.plot_eclipse_array({'time_unit': 'seconds', 'show': True})
def test_Cell_Double(): cell = stypes.Cell_Double(8) spice.appndd(1.1, cell) spice.appndd(2.2, cell) spice.appndd(3.3, cell) assert [x for x in cell] == [1.1,2.2,3.3]