diff --git a/.gitignore b/.gitignore index 0f7af047..3fdfbe88 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,6 @@ spiceypy/utils/__pycache__/ *.whl .pytest_cache/ *.sqlite3 +spiceypy/utils/cspice.dll +.vscode /badhashkernel.txt diff --git a/README.rst b/README.rst index 9ae08cce..0943efe4 100644 --- a/README.rst +++ b/README.rst @@ -124,3 +124,4 @@ Acknowledgements `DaRasch `__ wrote spiceminer, which I looked at to get SpiceCells working, thanks! + diff --git a/docs/multithread.rst b/docs/multithread.rst new file mode 100644 index 00000000..18faeee9 --- /dev/null +++ b/docs/multithread.rst @@ -0,0 +1,28 @@ +Multithreading in SpiceyPy +====================== + +SpiceyPy by default enable a semaphore to avoid a cuncurrent call to the SpiceyPy functions. + +This semaphore system is intended to avoind a cuncurrent call to the kernel from different threads that could make fail +the called routine (e.g. 2 cuncurrent calls to 'spkezr' may fail into a DAF error due to spice internal errors) + +The handling of multiprocesses is not the scope of this feature. + +Occasionaly Enabling Multithreading +---------------- + +In order to activate the multithreading feature only when it is required, it is possible to disable the default behavior and use +the provided SpiceyPy function that returns the context manager to be used only where the feature is + +.. code:: python + + import spiceypy as spice + + spice.threading_lock_on() # the SpiceyPy multithread handler is disabled + + + with spice.threading_lock(): # the SpiceyPy multithread handler is enabled + ... + # do stuff with multithread + + # the SpiceyPy multithread handler is disabled again diff --git a/spiceypy/config.py b/spiceypy/config.py index 293854c6..1b1cdbc4 100644 --- a/spiceypy/config.py +++ b/spiceypy/config.py @@ -23,3 +23,5 @@ """ catch_false_founds = True + +enable_threading_lock = True diff --git a/spiceypy/spiceypy.py b/spiceypy/spiceypy.py index 79d3dd9f..371b5f03 100644 --- a/spiceypy/spiceypy.py +++ b/spiceypy/spiceypy.py @@ -22,12 +22,12 @@ SOFTWARE. """ import warnings -from contextlib import contextmanager +from contextlib import contextmanager, suppress from datetime import datetime, timezone import functools import ctypes from typing import Callable, Iterator, Iterable, Optional, Tuple, Union, Sequence - +import threading import numpy from numpy import ndarray, str_ @@ -36,6 +36,7 @@ from .utils.libspicehelper import libspice from . import config + from .utils.callbacks import ( UDFUNC, UDFUNS, @@ -77,6 +78,25 @@ _SPICE_EK_MAXQSEL = 100 # Twice the 50 in gcc-linux-64 _SPICE_EK_EKRCEX_ROOM_DEFAULT = 100 # Enough? +_spicelock = threading.RLock() + +def spicelock_for_multithread(f): + """ + Decorator for spiceypy to avoid concurrent calls to cspice lib. + + :return: + """ + @functools.wraps(f) + def lock(*args, **kwargs): + ctx = _spicelock if config.enable_threading_lock else suppress() + with ctx: + try: + res = f(*args, **kwargs) + return res + except BaseException: + raise + return lock + def warn_depricated_args(**kwargs) -> None: keys = list(kwargs.keys()) @@ -161,6 +181,57 @@ def wrapper(*args, **kwargs): return wrapper +@contextmanager +def no_threading_lock() -> Iterator[None]: + """ + Temporarily disables spiceypy default behavior which locks the access to the + SPICE library from multithreading cuncurrent operations. + All spice functions executed within the context manager will no longer lock the + access. + """ + current_threading_lock_state = config.enable_threading_lock + config.enable_threading_lock = False + yield + config.enable_threading_lock = current_threading_lock_state + + +@contextmanager +def threading_lock() -> Iterator[None]: + """ + Temporarily enables spiceypy default behavior which locks the access to the + SPICE library from multithreading cuncurrent operations. + All spice functions executed within the context manager will lock the + access preventing the access from other cuncurrent threads. + """ + current_threading_lock_state = config.enable_threading_lock + config.enable_threading_lock = True + yield + config.enable_threading_lock = current_threading_lock_state + + +def threading_lock_off() -> None: + """ + Method that turns off threading lock + + """ + config.enable_threading_lock = False + + +def threading_lock_on() -> None: + """ + Method that turns on threading lock + + """ + config.enable_threading_lock = True + + +def get_threading_lock_state() -> bool: + """ + Returns the current threading lock state + + :return: + """ + return config.enable_threading_lock @contextmanager def no_found_check() -> Iterator[None]: @@ -273,6 +344,7 @@ def cell_time(cell_size) -> SpiceCell: # A +@spicelock_for_multithread @spice_error_check def appndc( item: Union[str, Iterable[str], ndarray, str_], @@ -295,6 +367,7 @@ def appndc( libspice.appndc_c(item, cell) +@spicelock_for_multithread @spice_error_check def appndd( item: Union[float, Iterable[float]], cell: Union[SpiceCell, Cell_Double] @@ -316,6 +389,7 @@ def appndd( libspice.appndd_c(item, cell) +@spicelock_for_multithread @spice_error_check def appndi(item: Union[Iterable[int], int], cell: Union[SpiceCell, Cell_Int]) -> None: """ @@ -335,6 +409,7 @@ def appndi(item: Union[Iterable[int], int], cell: Union[SpiceCell, Cell_Int]) -> libspice.appndi_c(item, cell) +@spicelock_for_multithread @spice_error_check def axisar(axis: Union[ndarray, Iterable[float]], angle: float) -> ndarray: """ @@ -358,6 +433,7 @@ def axisar(axis: Union[ndarray, Iterable[float]], angle: float) -> ndarray: # B +@spicelock_for_multithread @spice_error_check def b1900() -> float: """ @@ -370,6 +446,7 @@ def b1900() -> float: return libspice.b1900_c() +@spicelock_for_multithread @spice_error_check def b1950() -> float: """ @@ -382,6 +459,7 @@ def b1950() -> float: return libspice.b1950_c() +@spicelock_for_multithread @spice_error_check def badkpv( caller: str, name: str, comp: str, insize: int, divby: int, intype: str @@ -409,6 +487,7 @@ def badkpv( return bool(libspice.badkpv_c(caller, name, comp, insize, divby, intype)) +@spicelock_for_multithread @spice_error_check def bltfrm(frmcls: int, out_cell: Optional[SpiceCell] = None) -> SpiceCell: """ @@ -428,6 +507,7 @@ def bltfrm(frmcls: int, out_cell: Optional[SpiceCell] = None) -> SpiceCell: return out_cell +@spicelock_for_multithread @spice_error_check def bodeul(body: int, et: float) -> Tuple[float, float, float, float]: """ @@ -462,6 +542,7 @@ def bodeul(body: int, et: float) -> Tuple[float, float, float, float]: return ra.value, dec.value, w.value, lam.value +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def bodc2n(code: int, lenout: int = _default_len_out) -> Tuple[str, bool]: @@ -483,6 +564,7 @@ def bodc2n(code: int, lenout: int = _default_len_out) -> Tuple[str, bool]: return stypes.to_python_string(name), bool(found.value) +@spicelock_for_multithread @spice_error_check def bodc2s(code: int, lenout: int = _default_len_out) -> str: """ @@ -503,6 +585,7 @@ def bodc2s(code: int, lenout: int = _default_len_out) -> str: return stypes.to_python_string(name) +@spicelock_for_multithread @spice_error_check def boddef(name: str, code: int) -> None: """ @@ -519,6 +602,7 @@ def boddef(name: str, code: int) -> None: libspice.boddef_c(name, code) +@spicelock_for_multithread @spice_error_check def bodfnd(body: int, item: str) -> bool: """ @@ -536,6 +620,7 @@ def bodfnd(body: int, item: str) -> bool: return bool(libspice.bodfnd_c(body, item)) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def bodn2c(name: str) -> Tuple[int, bool]: @@ -555,6 +640,7 @@ def bodn2c(name: str) -> Tuple[int, bool]: return code.value, bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def bods2c(name: str) -> Tuple[int, bool]: @@ -573,6 +659,7 @@ def bods2c(name: str) -> Tuple[int, bool]: return code.value, bool(found.value) +@spicelock_for_multithread @spice_error_check def bodvar(body: int, item: str, dim: int) -> ndarray: """ @@ -599,6 +686,7 @@ def bodvar(body: int, item: str, dim: int) -> ndarray: return stypes.c_vector_to_python(values) +@spicelock_for_multithread @spice_error_check def bodvcd(bodyid: int, item: str, maxn: int) -> Tuple[int, ndarray]: """ @@ -624,6 +712,7 @@ def bodvcd(bodyid: int, item: str, maxn: int) -> Tuple[int, ndarray]: return dim.value, stypes.c_vector_to_python(values) +@spicelock_for_multithread @spice_error_check def bodvrd(bodynm: str, item: str, maxn: int) -> Tuple[int, ndarray]: """ @@ -648,6 +737,7 @@ def bodvrd(bodynm: str, item: str, maxn: int) -> Tuple[int, ndarray]: return dim.value, stypes.c_vector_to_python(values) +@spicelock_for_multithread @spice_error_check def brcktd(number: float, end1: float, end2: float) -> float: """ @@ -669,6 +759,7 @@ def brcktd(number: float, end1: float, end2: float) -> float: return libspice.brcktd_c(number, end1, end2) +@spicelock_for_multithread @spice_error_check def brckti(number: int, end1: int, end2: int) -> int: """ @@ -690,6 +781,7 @@ def brckti(number: int, end1: int, end2: int) -> int: return libspice.brckti_c(number, end1, end2) +@spicelock_for_multithread @spice_error_check def bschoc( value: Union[str_, str], @@ -720,6 +812,7 @@ def bschoc( return libspice.bschoc_c(value, ndim, lenvals, array, order) +@spicelock_for_multithread @spice_error_check def bschoi( value: int, @@ -747,6 +840,7 @@ def bschoi( return libspice.bschoi_c(value, ndim, array, order) +@spicelock_for_multithread @spice_error_check def bsrchc(value: str, ndim: int, lenvals: int, array: Iterable[str]) -> int: """ @@ -769,6 +863,7 @@ def bsrchc(value: str, ndim: int, lenvals: int, array: Iterable[str]) -> int: return libspice.bsrchc_c(value, ndim, lenvals, array) +@spicelock_for_multithread @spice_error_check def bsrchd(value: float, ndim: int, array: ndarray) -> int: """ @@ -789,6 +884,7 @@ def bsrchd(value: float, ndim: int, array: ndarray) -> int: return libspice.bsrchd_c(value, ndim, array) +@spicelock_for_multithread @spice_error_check def bsrchi(value: int, ndim: int, array: ndarray) -> int: """ @@ -813,6 +909,7 @@ def bsrchi(value: int, ndim: int, array: ndarray) -> int: # C +@spicelock_for_multithread @spice_error_check def card(cell: SpiceCell) -> int: """ @@ -827,6 +924,7 @@ def card(cell: SpiceCell) -> int: return libspice.card_c(ctypes.byref(cell)) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def ccifrm( @@ -870,6 +968,7 @@ def ccifrm( ) +@spicelock_for_multithread @spice_error_check def cgv2el( center: Union[ndarray, Iterable[float]], @@ -894,6 +993,7 @@ def cgv2el( return ellipse +@spicelock_for_multithread @spice_error_check def chbder( cp: Union[ndarray, Iterable[float]], @@ -927,6 +1027,7 @@ def chbder( return stypes.c_vector_to_python(dpdxs) +@spicelock_for_multithread @spice_error_check def chkin(module: str) -> None: """ @@ -940,6 +1041,7 @@ def chkin(module: str) -> None: libspice.chkin_c(module) +@spicelock_for_multithread @spice_error_check def chkout(module: str) -> None: """ @@ -953,6 +1055,7 @@ def chkout(module: str) -> None: libspice.chkout_c(module) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def cidfrm(cent: int, lenout: int = _default_len_out) -> Tuple[int, str, bool]: @@ -976,6 +1079,7 @@ def cidfrm(cent: int, lenout: int = _default_len_out) -> Tuple[int, str, bool]: return frcode.value, stypes.to_python_string(frname), bool(found.value) +@spicelock_for_multithread @spice_error_check def ckcls(handle: int) -> None: """ @@ -989,6 +1093,7 @@ def ckcls(handle: int) -> None: libspice.ckcls_c(handle) +@spicelock_for_multithread @spice_error_check def ckcov( ck: str, @@ -1027,6 +1132,7 @@ def ckcov( return cover +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def ckfrot(inst: int, et: float) -> Tuple[ndarray, int, bool]: @@ -1055,6 +1161,7 @@ def ckfrot(inst: int, et: float) -> Tuple[ndarray, int, bool]: return stypes.c_matrix_to_numpy(rotate_m), ref.value, bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def ckgp( @@ -1086,6 +1193,7 @@ def ckgp( return stypes.c_matrix_to_numpy(cmat), clkout.value, bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def ckgpav( @@ -1125,6 +1233,7 @@ def ckgpav( ) +@spicelock_for_multithread @spice_error_check def cklpf(filename: str) -> int: """ @@ -1143,6 +1252,7 @@ def cklpf(filename: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def ckobj(ck: str, out_cell: Optional[SpiceCell] = None) -> SpiceCell: """ @@ -1164,6 +1274,7 @@ def ckobj(ck: str, out_cell: Optional[SpiceCell] = None) -> SpiceCell: return out_cell +@spicelock_for_multithread @spice_error_check def ckopn(filename: str, ifname: str, ncomch: int) -> int: """ @@ -1184,6 +1295,7 @@ def ckopn(filename: str, ifname: str, ncomch: int) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def ckupf(handle: int) -> None: """ @@ -1198,6 +1310,7 @@ def ckupf(handle: int) -> None: libspice.ckupf_c(handle) +@spicelock_for_multithread @spice_error_check def ckw01( handle: int, @@ -1245,6 +1358,7 @@ def ckw01( ) +@spicelock_for_multithread @spice_error_check def ckw02( handle: int, @@ -1295,6 +1409,7 @@ def ckw02( ) +@spicelock_for_multithread @spice_error_check def ckw03( handle: int, @@ -1360,6 +1475,7 @@ def ckw03( ) +@spicelock_for_multithread @spice_error_check def ckw05( handle: int, @@ -1435,6 +1551,7 @@ def cleard() -> NotImplementedError: raise NotImplementedError +@spicelock_for_multithread @spice_error_check def clight() -> float: """ @@ -1447,6 +1564,7 @@ def clight() -> float: return libspice.clight_c() +@spicelock_for_multithread @spice_error_check def clpool() -> None: """ @@ -1458,6 +1576,7 @@ def clpool() -> None: libspice.clpool_c() +@spicelock_for_multithread @spice_error_check def cltext(fname: str) -> None: """ @@ -1487,6 +1606,7 @@ def cltext(fname: str) -> None: libspice.cltext_(fname_p, fname_len) +@spicelock_for_multithread @spice_error_check def cmprss(delim: str, n: int, instr: str, lenout: int = _default_len_out) -> str: """ @@ -1510,6 +1630,7 @@ def cmprss(delim: str, n: int, instr: str, lenout: int = _default_len_out) -> st return stypes.to_python_string(output) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def cnmfrm(cname: str, lenout: int = _default_len_out) -> Tuple[int, str, bool]: @@ -1533,6 +1654,7 @@ def cnmfrm(cname: str, lenout: int = _default_len_out) -> Tuple[int, str, bool]: return frcode.value, stypes.to_python_string(frname), bool(found.value) +@spicelock_for_multithread @spice_error_check def conics(elts: ndarray, et: float) -> ndarray: """ @@ -1553,6 +1675,7 @@ def conics(elts: ndarray, et: float) -> ndarray: return stypes.c_vector_to_python(state) +@spicelock_for_multithread @spice_error_check def convrt( x: Union[float, Iterable[float]], inunit: str, outunit: str @@ -1586,6 +1709,7 @@ def convrt( return y.value +@spicelock_for_multithread @spice_error_check def copy(cell: SpiceCell) -> SpiceCell: """ @@ -1612,6 +1736,7 @@ def copy(cell: SpiceCell) -> SpiceCell: return newcopy +@spicelock_for_multithread @spice_error_check def cpos(string: str, chars: str, start: int) -> int: """ @@ -1634,6 +1759,7 @@ def cpos(string: str, chars: str, start: int) -> int: return libspice.cpos_c(string, chars, start) +@spicelock_for_multithread @spice_error_check def cposr(string: str, chars: str, start: int) -> int: """ @@ -1656,6 +1782,7 @@ def cposr(string: str, chars: str, start: int) -> int: return libspice.cposr_c(string, chars, start) +@spicelock_for_multithread @spice_error_check def cvpool(agent: str) -> bool: """ @@ -1673,6 +1800,7 @@ def cvpool(agent: str) -> bool: return bool(update.value) +@spicelock_for_multithread @spice_error_check def cyllat(r: float, lonc: float, z: float) -> Tuple[float, float, float]: """ @@ -1697,6 +1825,7 @@ def cyllat(r: float, lonc: float, z: float) -> Tuple[float, float, float]: return radius.value, lon.value, lat.value +@spicelock_for_multithread @spice_error_check def cylrec(r: float, lon: float, z: float) -> ndarray: """ @@ -1717,6 +1846,7 @@ def cylrec(r: float, lon: float, z: float) -> ndarray: return stypes.c_vector_to_python(rectan) +@spicelock_for_multithread @spice_error_check def cylsph(r: float, lonc: float, z: float) -> Tuple[float, float, float]: """ @@ -1748,6 +1878,7 @@ def cylsph(r: float, lonc: float, z: float) -> Tuple[float, float, float]: # D +@spicelock_for_multithread @spice_error_check def dafac(handle: int, buffer: Sequence[str]) -> None: """ @@ -1767,6 +1898,7 @@ def dafac(handle: int, buffer: Sequence[str]) -> None: libspice.dafac_c(handle, n, lenvals, buffer) +@spicelock_for_multithread @spice_error_check def dafbbs(handle: int) -> None: """ @@ -1780,6 +1912,7 @@ def dafbbs(handle: int) -> None: libspice.dafbbs_c(handle) +@spicelock_for_multithread @spice_error_check def dafbfs(handle: int) -> None: """ @@ -1793,6 +1926,7 @@ def dafbfs(handle: int) -> None: libspice.dafbfs_c(handle) +@spicelock_for_multithread @spice_error_check def dafcls(handle: int) -> None: """ @@ -1806,6 +1940,7 @@ def dafcls(handle: int) -> None: libspice.dafcls_c(handle) +@spicelock_for_multithread @spice_error_check def dafcs(handle: int) -> None: """ @@ -1820,6 +1955,7 @@ def dafcs(handle: int) -> None: libspice.dafcs_c(handle) +@spicelock_for_multithread @spice_error_check def dafdc(handle: int) -> None: """ @@ -1833,6 +1969,7 @@ def dafdc(handle: int) -> None: libspice.dafdc_c(handle) +@spicelock_for_multithread @spice_error_check def dafec( handle: int, bufsiz: int, lenout: int = _default_len_out @@ -1867,6 +2004,7 @@ def dafec( return n.value, stypes.c_vector_to_python(buffer), bool(done.value) +@spicelock_for_multithread @spice_error_check def daffna() -> bool: """ @@ -1881,6 +2019,7 @@ def daffna() -> bool: return bool(found.value) +@spicelock_for_multithread @spice_error_check def daffpa() -> bool: """ @@ -1895,6 +2034,7 @@ def daffpa() -> bool: return bool(found.value) +@spicelock_for_multithread @spice_error_check def dafgda(handle: int, begin: int, end: int) -> ndarray: """ @@ -1915,6 +2055,7 @@ def dafgda(handle: int, begin: int, end: int) -> ndarray: return stypes.c_vector_to_python(data) +@spicelock_for_multithread @spice_error_check def dafgh() -> int: """ @@ -1929,6 +2070,7 @@ def dafgh() -> int: return outvalue.value +@spicelock_for_multithread @spice_error_check def dafgn(lenout: int = _default_len_out) -> str: """ @@ -1945,6 +2087,7 @@ def dafgn(lenout: int = _default_len_out) -> str: return stypes.to_python_string(name) +@spicelock_for_multithread @spice_error_check def dafgs(n: int = 125) -> ndarray: # The 125 may be a hard set, @@ -1963,6 +2106,7 @@ def dafgs(n: int = 125) -> ndarray: return stypes.c_vector_to_python(retarray)[0:n] +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def dafgsr(handle: int, recno: int, begin: int, end: int) -> Tuple[ndarray, bool]: @@ -1988,6 +2132,7 @@ def dafgsr(handle: int, recno: int, begin: int, end: int) -> Tuple[ndarray, bool return stypes.c_vector_to_python(data), bool(found.value) +@spicelock_for_multithread @spice_error_check def dafopr(fname: str) -> int: """ @@ -2004,6 +2149,7 @@ def dafopr(fname: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def dafopw(fname: str) -> int: """ @@ -2020,6 +2166,7 @@ def dafopw(fname: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def dafps(nd: int, ni: int, dc: ndarray, ic: ndarray) -> ndarray: """ @@ -2043,6 +2190,7 @@ def dafps(nd: int, ni: int, dc: ndarray, ic: ndarray) -> ndarray: return stypes.c_vector_to_python(outsum) +@spicelock_for_multithread @spice_error_check def dafrda(handle: int, begin: int, end: int) -> ndarray: """ @@ -2067,6 +2215,7 @@ def dafrda(handle: int, begin: int, end: int) -> ndarray: return stypes.c_vector_to_python(data) +@spicelock_for_multithread @spice_error_check def dafrfr( handle: int, lenout: int = _default_len_out @@ -2113,6 +2262,7 @@ def dafrfr( ) +@spicelock_for_multithread @spice_error_check def dafrs(insum: ndarray) -> None: """ @@ -2126,6 +2276,7 @@ def dafrs(insum: ndarray) -> None: libspice.dafrs_c(ctypes.byref(insum)) +@spicelock_for_multithread @spice_error_check def dafus(insum: ndarray, nd: int, ni: int) -> Tuple[ndarray, ndarray]: """ @@ -2147,6 +2298,7 @@ def dafus(insum: ndarray, nd: int, ni: int) -> Tuple[ndarray, ndarray]: return stypes.c_vector_to_python(dc), stypes.c_vector_to_python(ic) +@spicelock_for_multithread @spice_error_check def dasac(handle: int, buffer: Sequence[str]) -> None: """ @@ -2166,6 +2318,7 @@ def dasac(handle: int, buffer: Sequence[str]) -> None: libspice.dasac_c(handle, n, buflen, buffer) +@spicelock_for_multithread @spice_error_check def dascls(handle: int) -> None: """ @@ -2179,6 +2332,7 @@ def dascls(handle: int) -> None: libspice.dascls_c(handle) +@spicelock_for_multithread @spice_error_check def dasdc(handle: int) -> None: """ @@ -2193,6 +2347,7 @@ def dasdc(handle: int) -> None: libspice.dasdc_c(handle) +@spicelock_for_multithread @spice_error_check def dasec( handle: int, bufsiz: int = _default_len_out, buflen: int = _default_len_out @@ -2227,6 +2382,7 @@ def dasec( return n.value, stypes.c_vector_to_python(buffer), done.value +@spicelock_for_multithread @spice_error_check def dashfn(handle: int, lenout: int = _default_len_out) -> str: """ @@ -2245,6 +2401,7 @@ def dashfn(handle: int, lenout: int = _default_len_out) -> str: return stypes.to_python_string(fname) +@spicelock_for_multithread @spice_error_check def dasonw(fname: str, ftype: str, ifname: str, ncomch: int) -> int: """ @@ -2277,6 +2434,7 @@ def dasonw(fname: str, ftype: str, ifname: str, ncomch: int) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def dasopr(fname: str) -> int: """ @@ -2293,6 +2451,7 @@ def dasopr(fname: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def dasopw(fname: str) -> int: """ @@ -2308,6 +2467,7 @@ def dasopw(fname: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def dasrfr( handle: int, lenout: int = _default_len_out @@ -2353,6 +2513,7 @@ def dasrfr( ) +@spicelock_for_multithread @spice_error_check def dcyldr(x: float, y: float, z: float) -> ndarray: """ @@ -2374,6 +2535,7 @@ def dcyldr(x: float, y: float, z: float) -> ndarray: return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def deltet(epoch: float, eptype: str) -> float: """ @@ -2392,6 +2554,7 @@ def deltet(epoch: float, eptype: str) -> float: return delta.value +@spicelock_for_multithread @spice_error_check def det(m1: ndarray) -> float: """ @@ -2406,6 +2569,7 @@ def det(m1: ndarray) -> float: return libspice.det_c(m1) +@spicelock_for_multithread @spice_error_check def dgeodr(x: float, y: float, z: float, re: float, f: float) -> ndarray: """ @@ -2431,6 +2595,7 @@ def dgeodr(x: float, y: float, z: float, re: float, f: float) -> ndarray: return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def diags2( symmat: Union[ndarray, Iterable[Iterable[float]]] @@ -2452,6 +2617,7 @@ def diags2( return stypes.c_matrix_to_numpy(diag), stypes.c_matrix_to_numpy(rotateout) +@spicelock_for_multithread @spice_error_check def diff(a: SpiceCell, b: SpiceCell) -> SpiceCell: """ @@ -2479,6 +2645,7 @@ def diff(a: SpiceCell, b: SpiceCell) -> SpiceCell: return c +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def dlabbs(handle: int) -> Tuple[SpiceDLADescr, bool]: @@ -2497,6 +2664,7 @@ def dlabbs(handle: int) -> Tuple[SpiceDLADescr, bool]: return descr, bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def dlabfs(handle: int) -> Tuple[SpiceDLADescr, bool]: @@ -2515,6 +2683,7 @@ def dlabfs(handle: int) -> Tuple[SpiceDLADescr, bool]: return descr, bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def dlafns(handle: int, descr: SpiceDLADescr) -> Tuple[SpiceDLADescr, bool]: @@ -2537,6 +2706,7 @@ def dlafns(handle: int, descr: SpiceDLADescr) -> Tuple[SpiceDLADescr, bool]: return nxtdsc, bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def dlafps(handle: int, descr: SpiceDLADescr) -> Tuple[SpiceDLADescr, bool]: @@ -2559,6 +2729,7 @@ def dlafps(handle: int, descr: SpiceDLADescr) -> Tuple[SpiceDLADescr, bool]: return prvdsc, bool(found.value) +@spicelock_for_multithread @spice_error_check def dlatdr(x: float, y: float, z: float) -> ndarray: """ @@ -2580,6 +2751,7 @@ def dlatdr(x: float, y: float, z: float) -> ndarray: return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def dp2hx(number: float, lenout: int = _default_len_out) -> str: """ @@ -2600,6 +2772,7 @@ def dp2hx(number: float, lenout: int = _default_len_out) -> str: return stypes.to_python_string(string) +@spicelock_for_multithread @spice_error_check def dpgrdr(body: str, x: float, y: float, z: int, re: float, f: float) -> ndarray: """ @@ -2627,6 +2800,7 @@ def dpgrdr(body: str, x: float, y: float, z: int, re: float, f: float) -> ndarra return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def dpmax() -> float: """ @@ -2642,6 +2816,7 @@ def dpmax() -> float: return libspice.dpmax_c() +@spicelock_for_multithread @spice_error_check def dpmin() -> float: """ @@ -2657,6 +2832,7 @@ def dpmin() -> float: return libspice.dpmin_c() +@spicelock_for_multithread @spice_error_check def dpr() -> float: """ @@ -2669,6 +2845,7 @@ def dpr() -> float: return libspice.dpr_c() +@spicelock_for_multithread @spice_error_check def drdcyl(r: float, lon: float, z: float) -> ndarray: """ @@ -2690,6 +2867,7 @@ def drdcyl(r: float, lon: float, z: float) -> ndarray: return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def drdgeo(lon: float, lat: float, alt: float, re: float, f: float) -> ndarray: """ @@ -2715,6 +2893,7 @@ def drdgeo(lon: float, lat: float, alt: float, re: float, f: float) -> ndarray: return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def drdlat(r: float, lon: float, lat: float) -> ndarray: """ @@ -2736,6 +2915,7 @@ def drdlat(r: float, lon: float, lat: float) -> ndarray: return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def drdpgr(body: str, lon: float, lat: float, alt: int, re: float, f: float) -> ndarray: """ @@ -2763,6 +2943,7 @@ def drdpgr(body: str, lon: float, lat: float, alt: int, re: float, f: float) -> return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def drdsph(r: float, colat: float, lon: float) -> ndarray: """ @@ -2784,6 +2965,7 @@ def drdsph(r: float, colat: float, lon: float) -> ndarray: return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check def dskb02( handle: int, dladsc: SpiceDLADescr @@ -2840,6 +3022,7 @@ def dskb02( ) +@spicelock_for_multithread @spice_error_check def dskcls(handle: int, optmiz: bool = False) -> None: """ @@ -2856,6 +3039,7 @@ def dskcls(handle: int, optmiz: bool = False) -> None: libspice.dskcls_c(handle, optmiz) +@spicelock_for_multithread @spice_error_check def dskd02( handle: int, dladsc: SpiceDLADescr, item: int, start: int, room: int @@ -2883,6 +3067,7 @@ def dskd02( return stypes.c_vector_to_python(values) +@spicelock_for_multithread @spice_error_check def dskgd(handle: int, dladsc: SpiceDLADescr) -> SpiceDSKDescr: """ @@ -2901,6 +3086,7 @@ def dskgd(handle: int, dladsc: SpiceDLADescr) -> SpiceDSKDescr: return dskdsc +@spicelock_for_multithread @spice_error_check def dskgtl(keywrd: int) -> float: """ @@ -2917,6 +3103,7 @@ def dskgtl(keywrd: int) -> float: return dpval.value +@spicelock_for_multithread @spice_error_check def dski02( handle: int, dladsc: SpiceDLADescr, item: int, start: int, room: int @@ -2943,6 +3130,7 @@ def dski02( return stypes.c_matrix_to_numpy(values) +@spicelock_for_multithread @spice_error_check def dskmi2( vrtces: ndarray, @@ -3007,6 +3195,7 @@ def dskmi2( return stypes.c_vector_to_python(spaixd), stypes.c_vector_to_python(spaixi) +@spicelock_for_multithread @spice_error_check def dskn02(handle: int, dladsc: SpiceDLADescr, plid: int) -> ndarray: """ @@ -3027,6 +3216,7 @@ def dskn02(handle: int, dladsc: SpiceDLADescr, plid: int) -> ndarray: return stypes.c_vector_to_python(normal) +@spicelock_for_multithread @spice_error_check def dskobj(dsk: str) -> SpiceCell: """ @@ -3044,6 +3234,7 @@ def dskobj(dsk: str) -> SpiceCell: return bodids +@spicelock_for_multithread @spice_error_check def dskopn(fname: str, ifname: str, ncomch: int) -> int: """ @@ -3064,6 +3255,7 @@ def dskopn(fname: str, ifname: str, ncomch: int) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def dskp02(handle: int, dladsc: SpiceDLADescr, start: int, room: int) -> ndarray: """ @@ -3087,6 +3279,7 @@ def dskp02(handle: int, dladsc: SpiceDLADescr, start: int, room: int) -> ndarray return stypes.c_matrix_to_numpy(plates) +@spicelock_for_multithread @spice_error_check def dskrb2( vrtces: ndarray, plates: ndarray, corsys: int, corpar: ndarray @@ -3125,6 +3318,7 @@ def dskrb2( return mncor3.value, mxcor3.value +@spicelock_for_multithread @spice_error_check def dsksrf(dsk: str, bodyid: int) -> SpiceCell: """ @@ -3144,6 +3338,7 @@ def dsksrf(dsk: str, bodyid: int) -> SpiceCell: return srfids +@spicelock_for_multithread @spice_error_check def dskstl(keywrd: int, dpval: float) -> None: """ @@ -3160,6 +3355,7 @@ def dskstl(keywrd: int, dpval: float) -> None: libspice.dskstl_c(keywrd, dpval) +@spicelock_for_multithread @spice_error_check def dskv02(handle: int, dladsc: SpiceDLADescr, start: int, room: int) -> ndarray: """ @@ -3182,6 +3378,7 @@ def dskv02(handle: int, dladsc: SpiceDLADescr, start: int, room: int) -> ndarray return stypes.c_matrix_to_numpy(vrtces) +@spicelock_for_multithread @spice_error_check def dskw02( handle: int, @@ -3275,6 +3472,7 @@ def dskw02( ) +@spicelock_for_multithread @spice_error_check def dskx02( handle: int, dladsc: SpiceDLADescr, vertex: ndarray, raydir: ndarray @@ -3310,6 +3508,7 @@ def dskx02( return plid.value, stypes.c_vector_to_python(xpt), bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def dskxsi( @@ -3386,6 +3585,7 @@ def dskxsi( ) +@spicelock_for_multithread @spice_error_check def dskxv( pri: bool, @@ -3428,6 +3628,7 @@ def dskxv( return stypes.c_matrix_to_numpy(xptarr), stypes.c_vector_to_python(fndarr) +@spicelock_for_multithread @spice_error_check def dskz02(handle: int, dladsc: SpiceDLADescr) -> Tuple[int, int]: """ @@ -3447,6 +3648,7 @@ def dskz02(handle: int, dladsc: SpiceDLADescr) -> Tuple[int, int]: return nv.value, np.value +@spicelock_for_multithread @spice_error_check def dsphdr(x: float, y: float, z: float) -> ndarray: """ @@ -3469,6 +3671,7 @@ def dsphdr(x: float, y: float, z: float) -> ndarray: return stypes.c_matrix_to_numpy(jacobi) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def dtpool(name: str) -> Tuple[int, str, bool]: @@ -3490,6 +3693,7 @@ def dtpool(name: str) -> Tuple[int, str, bool]: return n.value, stypes.to_python_string(typeout.value), bool(found.value) +@spicelock_for_multithread @spice_error_check def ducrss(s1: ndarray, s2: ndarray) -> ndarray: """ @@ -3510,6 +3714,7 @@ def ducrss(s1: ndarray, s2: ndarray) -> ndarray: return stypes.c_vector_to_python(sout) +@spicelock_for_multithread @spice_error_check def dvcrss(s1: ndarray, s2: ndarray) -> ndarray: """ @@ -3530,6 +3735,7 @@ def dvcrss(s1: ndarray, s2: ndarray) -> ndarray: return stypes.c_vector_to_python(sout) +@spicelock_for_multithread @spice_error_check def dvdot(s1: Sequence[float], s2: Sequence[float]) -> float: """ @@ -3548,6 +3754,7 @@ def dvdot(s1: Sequence[float], s2: Sequence[float]) -> float: return libspice.dvdot_c(s1, s2) +@spicelock_for_multithread @spice_error_check def dvhat(s1: ndarray) -> ndarray: """ @@ -3566,6 +3773,7 @@ def dvhat(s1: ndarray) -> ndarray: return stypes.c_vector_to_python(sout) +@spicelock_for_multithread @spice_error_check def dvnorm(state: ndarray) -> float: """ @@ -3582,6 +3790,7 @@ def dvnorm(state: ndarray) -> float: return libspice.dvnorm_c(state) +@spicelock_for_multithread @spice_error_check def dvpool(name: str) -> None: """ @@ -3595,6 +3804,7 @@ def dvpool(name: str) -> None: libspice.dvpool_c(name) +@spicelock_for_multithread @spice_error_check def dvsep(s1: ndarray, s2: ndarray) -> float: """ @@ -3617,6 +3827,7 @@ def dvsep(s1: ndarray, s2: ndarray) -> float: # E +@spicelock_for_multithread @spice_error_check def edlimb( a: float, @@ -3644,6 +3855,7 @@ def edlimb( return limb +@spicelock_for_multithread @spice_error_check def edterm( trmtyp: str, @@ -3706,6 +3918,7 @@ def edterm( ) +@spicelock_for_multithread @spice_error_check def ekacec( handle: int, @@ -3740,6 +3953,7 @@ def ekacec( libspice.ekacec_c(handle, segno, recno, column, nvals, vallen, cvals, isnull) +@spicelock_for_multithread @spice_error_check def ekaced( handle: int, @@ -3773,6 +3987,7 @@ def ekaced( libspice.ekaced_c(handle, segno, recno, column, nvals, dvals, isnull) +@spicelock_for_multithread @spice_error_check def ekacei( handle: int, @@ -3806,6 +4021,7 @@ def ekacei( libspice.ekacei_c(handle, segno, recno, column, nvals, ivals, isnull) +@spicelock_for_multithread @spice_error_check def ekaclc( handle: int, @@ -3849,6 +4065,7 @@ def ekaclc( return stypes.c_vector_to_python(wkindx) +@spicelock_for_multithread @spice_error_check def ekacld( handle: int, @@ -3887,6 +4104,7 @@ def ekacld( return stypes.c_vector_to_python(wkindx) +@spicelock_for_multithread @spice_error_check def ekacli( handle: int, @@ -3925,6 +4143,7 @@ def ekacli( return stypes.c_vector_to_python(wkindx) +@spicelock_for_multithread @spice_error_check def ekappr(handle: int, segno: int) -> int: """ @@ -3943,6 +4162,7 @@ def ekappr(handle: int, segno: int) -> int: return recno.value +@spicelock_for_multithread @spice_error_check def ekbseg( handle: int, tabnam: str, cnames: Sequence[str], decls: Sequence[str] @@ -3974,6 +4194,7 @@ def ekbseg( return segno.value +@spicelock_for_multithread @spice_error_check def ekccnt(table: str) -> int: """ @@ -3991,6 +4212,7 @@ def ekccnt(table: str) -> int: return ccount.value +@spicelock_for_multithread @spice_error_check def ekcii( table: str, cindex: int, lenout: int = _default_len_out @@ -4015,6 +4237,7 @@ def ekcii( return stypes.to_python_string(column), attdsc +@spicelock_for_multithread @spice_error_check def ekcls(handle: int) -> None: """ @@ -4028,6 +4251,7 @@ def ekcls(handle: int) -> None: libspice.ekcls_c(handle) +@spicelock_for_multithread @spice_error_check def ekdelr(handle: int, segno: int, recno: int) -> None: """ @@ -4045,6 +4269,7 @@ def ekdelr(handle: int, segno: int, recno: int) -> None: libspice.ekdelr_c(handle, segno, recno) +@spicelock_for_multithread @spice_error_check def ekffld(handle: int, segno: int, rcptrs: ndarray) -> None: """ @@ -4062,6 +4287,7 @@ def ekffld(handle: int, segno: int, rcptrs: ndarray) -> None: libspice.ekffld_c(handle, segno, ctypes.cast(rcptrs, ctypes.POINTER(ctypes.c_int))) +@spicelock_for_multithread @spice_error_check def ekfind(query: str, lenout: int = _default_len_out) -> Tuple[int, int, str]: """ @@ -4085,6 +4311,7 @@ def ekfind(query: str, lenout: int = _default_len_out) -> Tuple[int, int, str]: return nmrows.value, error.value, stypes.to_python_string(errmsg) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def ekgc( @@ -4117,6 +4344,7 @@ def ekgc( return stypes.to_python_string(cdata), null.value, bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def ekgd(selidx: int, row: int, element: int) -> Tuple[float, int, bool]: @@ -4150,6 +4378,7 @@ def ekgd(selidx: int, row: int, element: int) -> Tuple[float, int, bool]: return ddata.value, null.value, bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def ekgi(selidx: int, row: int, element: int) -> Tuple[int, int, bool]: @@ -4183,6 +4412,7 @@ def ekgi(selidx: int, row: int, element: int) -> Tuple[int, int, bool]: return idata.value, null.value, bool(found.value) +@spicelock_for_multithread @spice_error_check def ekifld( handle: int, @@ -4234,6 +4464,7 @@ def ekifld( return segno.value, stypes.c_vector_to_python(recptrs) +@spicelock_for_multithread @spice_error_check def ekinsr(handle: int, segno: int, recno: int) -> None: """ @@ -4252,6 +4483,7 @@ def ekinsr(handle: int, segno: int, recno: int) -> None: libspice.ekinsr_c(handle, segno, recno) +@spicelock_for_multithread @spice_error_check def eklef(fname: str) -> int: """ @@ -4268,6 +4500,7 @@ def eklef(fname: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def eknelt(selidx: int, row: int) -> int: """ @@ -4285,6 +4518,7 @@ def eknelt(selidx: int, row: int) -> int: return libspice.eknelt_c(selidx, row) +@spicelock_for_multithread @spice_error_check def eknseg(handle: int) -> int: """ @@ -4299,6 +4533,7 @@ def eknseg(handle: int) -> int: return libspice.eknseg_c(handle) +@spicelock_for_multithread @spice_error_check def ekntab() -> int: """ @@ -4313,6 +4548,7 @@ def ekntab() -> int: return n.value +@spicelock_for_multithread @spice_error_check def ekopn(fname: str, ifname: str, ncomch: int) -> int: """ @@ -4333,6 +4569,7 @@ def ekopn(fname: str, ifname: str, ncomch: int) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def ekopr(fname: str) -> int: """ @@ -4349,6 +4586,7 @@ def ekopr(fname: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def ekops() -> int: """ @@ -4364,6 +4602,7 @@ def ekops() -> int: return handle.value +@spicelock_for_multithread @spice_error_check def ekopw(fname: str) -> int: """ @@ -4380,6 +4619,7 @@ def ekopw(fname: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def ekpsel( query: str, msglen: int, tablen: int, collen: int @@ -4449,6 +4689,7 @@ def ekpsel( ) +@spicelock_for_multithread @spice_error_check def ekrcec( handle: int, @@ -4500,6 +4741,7 @@ def ekrcec( ) +@spicelock_for_multithread @spice_error_check def ekrced( handle: int, @@ -4541,6 +4783,7 @@ def ekrced( ) +@spicelock_for_multithread @spice_error_check def ekrcei( handle: int, @@ -4582,6 +4825,7 @@ def ekrcei( ) +@spicelock_for_multithread @spice_error_check def ekssum(handle: int, segno: int) -> SpiceEKSegSum: """ @@ -4600,6 +4844,7 @@ def ekssum(handle: int, segno: int) -> SpiceEKSegSum: return segsum +@spicelock_for_multithread @spice_error_check def ektnam(n: int, lenout: int = _default_len_out) -> str: """ @@ -4618,6 +4863,7 @@ def ektnam(n: int, lenout: int = _default_len_out) -> str: return stypes.to_python_string(table) +@spicelock_for_multithread @spice_error_check def ekucec( handle: int, @@ -4652,6 +4898,7 @@ def ekucec( libspice.ekucec_c(handle, segno, recno, column, nvals, vallen, cvals, isnull) +@spicelock_for_multithread @spice_error_check def ekuced( handle: int, @@ -4685,6 +4932,7 @@ def ekuced( libspice.ekaced_c(handle, segno, recno, column, nvals, dvals, isnull) +@spicelock_for_multithread @spice_error_check def ekucei( handle: int, @@ -4718,6 +4966,7 @@ def ekucei( libspice.ekucei_c(handle, segno, recno, column, nvals, ivals, isnull) +@spicelock_for_multithread @spice_error_check def ekuef(handle: int) -> None: """ @@ -4733,6 +4982,7 @@ def ekuef(handle: int) -> None: libspice.ekuef_c(handle) +@spicelock_for_multithread @spice_error_check def el2cgv(ellipse: Ellipse) -> Tuple[ndarray, ndarray, ndarray]: """ @@ -4757,6 +5007,7 @@ def el2cgv(ellipse: Ellipse) -> Tuple[ndarray, ndarray, ndarray]: ) +@spicelock_for_multithread @spice_error_check def elemc(item: str, inset: SpiceCell) -> bool: """ @@ -4773,6 +5024,7 @@ def elemc(item: str, inset: SpiceCell) -> bool: return bool(libspice.elemc_c(item, ctypes.byref(inset))) +@spicelock_for_multithread @spice_error_check def elemd(item: float, inset: SpiceCell) -> bool: """ @@ -4790,6 +5042,7 @@ def elemd(item: float, inset: SpiceCell) -> bool: return bool(libspice.elemd_c(item, ctypes.byref(inset))) +@spicelock_for_multithread @spice_error_check def elemi(item: int, inset: SpiceCell) -> bool: """ @@ -4807,6 +5060,7 @@ def elemi(item: int, inset: SpiceCell) -> bool: return bool(libspice.elemi_c(item, ctypes.byref(inset))) +@spicelock_for_multithread @spice_error_check def eqncpv( et: float, @@ -4839,6 +5093,7 @@ def eqncpv( return stypes.c_vector_to_python(state) +@spicelock_for_multithread @spice_error_check def eqstr(a: str, b: str) -> bool: """ @@ -4982,6 +5237,7 @@ def esrchc(value: str, array: Sequence[str]) -> int: return libspice.esrchc_c(value, ndim, lenvals, array) +@spicelock_for_multithread @spice_error_check def et2lst( et: float, @@ -5043,6 +5299,7 @@ def et2lst( ) +@spicelock_for_multithread @spice_error_check def et2utc( et: Union[float, Iterable[float]], @@ -5078,6 +5335,7 @@ def et2utc( return stypes.to_python_string(utcstr) +@spicelock_for_multithread @spice_error_check def etcal( et: Union[float, ndarray], lenout: int = _default_len_out @@ -5108,6 +5366,7 @@ def etcal( return stypes.to_python_string(string) +@spicelock_for_multithread @spice_error_check def eul2m( angle3: float, angle2: float, angle1: float, axis3: int, axis2: int, axis1: int @@ -5136,6 +5395,7 @@ def eul2m( return stypes.c_matrix_to_numpy(r) +@spicelock_for_multithread @spice_error_check def eul2xf(eulang: Sequence[float], axisa: int, axisb: int, axisc: int) -> ndarray: """ @@ -5161,6 +5421,7 @@ def eul2xf(eulang: Sequence[float], axisa: int, axisb: int, axisc: int) -> ndarr return stypes.c_matrix_to_numpy(xform) +@spicelock_for_multithread @spice_error_check def ev2lin(et: float, geophs: Sequence[float], elems: Sequence[float]) -> ndarray: """ @@ -5185,6 +5446,7 @@ def ev2lin(et: float, geophs: Sequence[float], elems: Sequence[float]) -> ndarra return stypes.c_vector_to_python(state) +@spicelock_for_multithread @spice_error_check def exists(fname: str) -> bool: """ @@ -5199,6 +5461,7 @@ def exists(fname: str) -> bool: return bool(libspice.exists_c(fname)) +@spicelock_for_multithread @spice_error_check def expool(name: str) -> bool: """ @@ -5230,6 +5493,7 @@ def failed() -> bool: return bool(libspice.failed_c()) +@spicelock_for_multithread @spice_error_check def fn2lun(fname: str) -> int: """ @@ -5248,6 +5512,7 @@ def fn2lun(fname: str) -> int: return unit_out.value +@spicelock_for_multithread @spice_error_check def fovray( inst: str, @@ -5284,6 +5549,7 @@ def fovray( return bool(visible.value) +@spicelock_for_multithread @spice_error_check def fovtrg( inst: str, @@ -5330,6 +5596,7 @@ def fovtrg( return bool(visible.value) +@spicelock_for_multithread @spice_error_check def frame(x: Union[ndarray, Iterable[float]]) -> Tuple[ndarray, ndarray, ndarray]: """ @@ -5349,6 +5616,7 @@ def frame(x: Union[ndarray, Iterable[float]]) -> Tuple[ndarray, ndarray, ndarray ) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def frinfo(frcode: int) -> Tuple[int, int, int, bool]: @@ -5373,6 +5641,7 @@ def frinfo(frcode: int) -> Tuple[int, int, int, bool]: return cent.value, frclss.value, clssid.value, bool(found.value) +@spicelock_for_multithread @spice_error_check def frmnam(frcode: int, lenout: int = _default_len_out) -> str: """ @@ -5391,6 +5660,7 @@ def frmnam(frcode: int, lenout: int = _default_len_out) -> str: return stypes.to_python_string(frname) +@spicelock_for_multithread @spice_error_check def ftncls(unit: int) -> None: """ @@ -5404,6 +5674,7 @@ def ftncls(unit: int) -> None: libspice.ftncls_c(unit) +@spicelock_for_multithread @spice_error_check def furnsh(path: Union[str, Iterable[str]]) -> None: """ @@ -5425,6 +5696,7 @@ def furnsh(path: Union[str, Iterable[str]]) -> None: # G +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def gcpool( @@ -5463,6 +5735,7 @@ def gcpool( ) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def gdpool(name: str, start: int, room: int) -> Tuple[ndarray, bool]: @@ -5493,6 +5766,7 @@ def gdpool(name: str, start: int, room: int) -> Tuple[ndarray, bool]: return stypes.c_vector_to_python(values)[0 : n.value], bool(found.value) +@spicelock_for_multithread @spice_error_check def georec(lon: float, lat: float, alt: float, re: float, f: float) -> ndarray: """ @@ -5520,6 +5794,7 @@ def georec(lon: float, lat: float, alt: float, re: float, f: float) -> ndarray: # getcml not really needed +@spicelock_for_multithread @spice_error_check def getelm(frstyr: int, lineln: int, lines: Iterable[str]) -> Tuple[float, ndarray]: """ @@ -5545,6 +5820,7 @@ def getelm(frstyr: int, lineln: int, lines: Iterable[str]) -> Tuple[float, ndarr return epoch.value, stypes.c_vector_to_python(elems) +@spicelock_for_multithread @spice_error_check def getfat(file: str) -> Tuple[str, str]: """ @@ -5564,6 +5840,7 @@ def getfat(file: str) -> Tuple[str, str]: return stypes.to_python_string(arch), stypes.to_python_string(rettype) +@spicelock_for_multithread @spice_error_check def getfov( instid: int, @@ -5628,6 +5905,7 @@ def getmsg(option: str, lenout: int = _default_len_out) -> str: return stypes.to_python_string(msg) +@spicelock_for_multithread @spice_error_check def gfbail() -> bool: """ @@ -5640,6 +5918,7 @@ def gfbail() -> bool: return bool(libspice.gfbail_c()) +@spicelock_for_multithread @spice_error_check def gfclrh() -> None: """ @@ -5652,6 +5931,7 @@ def gfclrh() -> None: libspice.gfclrh_c() +@spicelock_for_multithread @spice_error_check def gfdist( target: str, @@ -5712,6 +5992,7 @@ def gfdist( return result +@spicelock_for_multithread @spice_error_check def gfevnt( udstep: UDSTEP, @@ -5818,6 +6099,7 @@ def gfevnt( return result +@spicelock_for_multithread @spice_error_check def gffove( inst: str, @@ -5906,6 +6188,7 @@ def gffove( return result +@spicelock_for_multithread @spice_error_check def gfilum( method: str, @@ -5985,6 +6268,7 @@ def gfilum( return result +@spicelock_for_multithread @spice_error_check def gfinth(sigcode: int) -> None: """ @@ -6000,6 +6284,7 @@ def gfinth(sigcode: int) -> None: libspice.gfinth_c(sigcode) +@spicelock_for_multithread @spice_error_check def gfocce( occtyp: str, @@ -6098,6 +6383,7 @@ def gfocce( return result +@spicelock_for_multithread @spice_error_check def gfoclt( occtyp: str, @@ -6166,6 +6452,7 @@ def gfoclt( return result +@spicelock_for_multithread @spice_error_check def gfpa( target: str, @@ -6231,6 +6518,7 @@ def gfpa( return result +@spicelock_for_multithread @spice_error_check def gfposc( target: str, @@ -6303,6 +6591,7 @@ def gfposc( return result +@spicelock_for_multithread @spice_error_check def gfrefn(t1: float, t2: float, s1: Union[bool, int], s2: Union[bool, int]) -> float: """ @@ -6326,6 +6615,7 @@ def gfrefn(t1: float, t2: float, s1: Union[bool, int], s2: Union[bool, int]) -> return t.value +@spicelock_for_multithread @spice_error_check def gfrepf() -> None: """ @@ -6337,6 +6627,7 @@ def gfrepf() -> None: libspice.gfrepf_c() +@spicelock_for_multithread @spice_error_check def gfrepi( window: Union[SpiceCell, SpiceCellPointer], begmss: str, endmss: str @@ -6360,6 +6651,7 @@ def gfrepi( libspice.gfrepi_c(window, begmss, endmss) +@spicelock_for_multithread @spice_error_check def gfrepu(ivbeg: float, ivend: float, time: float) -> None: """ @@ -6378,6 +6670,7 @@ def gfrepu(ivbeg: float, ivend: float, time: float) -> None: libspice.gfrepu_c(ivbeg, ivend, time) +@spicelock_for_multithread @spice_error_check def gfrfov( inst: str, @@ -6431,6 +6724,7 @@ def gfrfov( return result +@spicelock_for_multithread @spice_error_check def gfrr( target: str, @@ -6491,6 +6785,7 @@ def gfrr( return result +@spicelock_for_multithread @spice_error_check def gfsep( targ1: str, @@ -6572,6 +6867,7 @@ def gfsep( return result +@spicelock_for_multithread @spice_error_check def gfsntc( target: str, @@ -6656,6 +6952,7 @@ def gfsntc( return result +@spicelock_for_multithread @spice_error_check def gfsstp(step: float) -> None: """ @@ -6669,6 +6966,7 @@ def gfsstp(step: float) -> None: libspice.gfsstp_c(step) +@spicelock_for_multithread @spice_error_check def gfstep(time: float) -> float: """ @@ -6685,6 +6983,7 @@ def gfstep(time: float) -> float: return step.value +@spicelock_for_multithread @spice_error_check def gfstol(value: float) -> None: """ @@ -6701,6 +7000,7 @@ def gfstol(value: float) -> None: libspice.gfstol_c(value) +@spicelock_for_multithread @spice_error_check def gfsubc( target: str, @@ -6777,6 +7077,7 @@ def gfsubc( return result +@spicelock_for_multithread @spice_error_check def gftfov( inst: str, @@ -6835,6 +7136,7 @@ def gftfov( return result +@spicelock_for_multithread @spice_error_check def gfudb( udfuns: UDFUNS, udfunb: UDFUNB, step: float, cnfine: SpiceCell, result: SpiceCell @@ -6855,6 +7157,7 @@ def gfudb( libspice.gfudb_c(udfuns, udfunb, step, ctypes.byref(cnfine), ctypes.byref(result)) +@spicelock_for_multithread @spice_error_check def gfuds( udfuns: UDFUNS, @@ -6902,6 +7205,7 @@ def gfuds( return result +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def gipool(name: str, start: int, room: int) -> Tuple[ndarray, bool]: @@ -6925,6 +7229,7 @@ def gipool(name: str, start: int, room: int) -> Tuple[ndarray, bool]: return stypes.c_vector_to_python(ivals)[0 : n.value], bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def gnpool( @@ -6958,6 +7263,7 @@ def gnpool( # H +@spicelock_for_multithread @spice_error_check def halfpi() -> float: """ @@ -6971,6 +7277,7 @@ def halfpi() -> float: return libspice.halfpi_c() +@spicelock_for_multithread @spice_error_check def hrmint( xvals: Sequence[float], yvals: Sequence[float], x: int @@ -6997,6 +7304,7 @@ def hrmint( return f.value, df.value +@spicelock_for_multithread @spice_error_check def hx2dp(string: str) -> Union[float, str]: """ @@ -7025,6 +7333,7 @@ def hx2dp(string: str) -> Union[float, str]: # I +@spicelock_for_multithread @spice_error_check def ident() -> ndarray: """ @@ -7039,6 +7348,7 @@ def ident() -> ndarray: return stypes.c_matrix_to_numpy(matrix) +@spicelock_for_multithread @spice_error_check def illum( target: str, et: float, abcorr: str, obsrvr: str, spoint: ndarray @@ -7084,6 +7394,7 @@ def illum( return phase.value, solar.value, emissn.value +@spicelock_for_multithread @spice_error_check def illumf( method: str, @@ -7165,6 +7476,7 @@ def illumf( ) +@spicelock_for_multithread @spice_error_check def illumg( method: str, @@ -7237,6 +7549,7 @@ def illumg( ) +@spicelock_for_multithread @spice_error_check def ilumin( method: str, @@ -7301,6 +7614,7 @@ def ilumin( ) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def inedpl(a: float, b: float, c: float, plane: Plane) -> Tuple[Ellipse, bool]: @@ -7327,6 +7641,7 @@ def inedpl(a: float, b: float, c: float, plane: Plane) -> Tuple[Ellipse, bool]: return ellipse, bool(found.value) +@spicelock_for_multithread @spice_error_check def inelpl(ellips: Ellipse, plane: Plane) -> Tuple[int, ndarray, ndarray]: """ @@ -7352,6 +7667,7 @@ def inelpl(ellips: Ellipse, plane: Plane) -> Tuple[int, ndarray, ndarray]: return nxpts.value, stypes.c_vector_to_python(xpt1), stypes.c_vector_to_python(xpt2) +@spicelock_for_multithread @spice_error_check def inrypl( vertex: Iterable[Union[float, float]], @@ -7380,6 +7696,7 @@ def inrypl( return nxpts.value, stypes.c_vector_to_python(xpt) +@spicelock_for_multithread @spice_error_check def insrtc(item: Union[str, Iterable[str]], inset: SpiceCell) -> None: """ @@ -7399,6 +7716,7 @@ def insrtc(item: Union[str, Iterable[str]], inset: SpiceCell) -> None: libspice.insrtc_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def insrtd(item: Union[float, Iterable[float]], inset: SpiceCell) -> None: """ @@ -7418,6 +7736,7 @@ def insrtd(item: Union[float, Iterable[float]], inset: SpiceCell) -> None: libspice.insrtd_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def insrti(item: Union[Iterable[int], int], inset: SpiceCell) -> None: """ @@ -7437,6 +7756,7 @@ def insrti(item: Union[Iterable[int], int], inset: SpiceCell) -> None: libspice.insrti_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def inter(a: SpiceCell, b: SpiceCell) -> SpiceCell: """ @@ -7465,6 +7785,7 @@ def inter(a: SpiceCell, b: SpiceCell) -> SpiceCell: return c +@spicelock_for_multithread @spice_error_check def intmax() -> int: """ @@ -7478,6 +7799,7 @@ def intmax() -> int: return libspice.intmax_c() +@spicelock_for_multithread @spice_error_check def intmin() -> int: """ @@ -7491,6 +7813,7 @@ def intmin() -> int: return libspice.intmin_c() +@spicelock_for_multithread @spice_error_check def invert(m: ndarray) -> ndarray: """ @@ -7507,6 +7830,7 @@ def invert(m: ndarray) -> ndarray: return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def invort(m: ndarray) -> ndarray: """ @@ -7525,6 +7849,7 @@ def invort(m: ndarray) -> ndarray: return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def irfnam(index: int) -> str: """ @@ -7543,6 +7868,7 @@ def irfnam(index: int) -> str: return stypes.to_python_string(name) +@spicelock_for_multithread @spice_error_check def irfnum(name: str) -> int: """ @@ -7561,6 +7887,7 @@ def irfnum(name: str) -> int: return index.value +@spicelock_for_multithread @spice_error_check def irfrot(refa: int, refb: int) -> ndarray: """ @@ -7581,6 +7908,7 @@ def irfrot(refa: int, refb: int) -> ndarray: return stypes.c_matrix_to_numpy(rotab).T +@spicelock_for_multithread @spice_error_check def irftrn(refa: str, refb: str) -> ndarray: """ @@ -7603,6 +7931,7 @@ def irftrn(refa: str, refb: str) -> ndarray: return stypes.c_matrix_to_numpy(rotab).T +@spicelock_for_multithread @spice_error_check def isordv(array: Union[ndarray, Iterable[int]], n: int) -> bool: """ @@ -7622,6 +7951,7 @@ def isordv(array: Union[ndarray, Iterable[int]], n: int) -> bool: return bool(libspice.isordv_c(array, n)) +@spicelock_for_multithread @spice_error_check def isrchc(value: str, ndim: int, lenvals: int, array: Iterable[str]) -> int: """ @@ -7646,6 +7976,7 @@ def isrchc(value: str, ndim: int, lenvals: int, array: Iterable[str]) -> int: return libspice.isrchc_c(value, ndim, lenvals, array) +@spicelock_for_multithread @spice_error_check def isrchd(value: float, ndim: int, array: Union[ndarray, Iterable[float]]) -> int: """ @@ -7668,6 +7999,7 @@ def isrchd(value: float, ndim: int, array: Union[ndarray, Iterable[float]]) -> i return libspice.isrchd_c(value, ndim, array) +@spicelock_for_multithread @spice_error_check def isrchi(value: int, ndim: int, array: Union[ndarray, Iterable[int]]) -> int: """ @@ -7690,6 +8022,7 @@ def isrchi(value: int, ndim: int, array: Union[ndarray, Iterable[int]]) -> int: return libspice.isrchi_c(value, ndim, array) +@spicelock_for_multithread @spice_error_check def isrot(m: ndarray, ntol: float, dtol: float) -> bool: """ @@ -7710,6 +8043,7 @@ def isrot(m: ndarray, ntol: float, dtol: float) -> bool: return bool(libspice.isrot_c(m, ntol, dtol)) +@spicelock_for_multithread @spice_error_check def iswhsp(string: str) -> bool: """ @@ -7731,6 +8065,7 @@ def iswhsp(string: str) -> bool: # J +@spicelock_for_multithread @spice_error_check def j1900() -> float: """ @@ -7741,6 +8076,7 @@ def j1900() -> float: return libspice.j1900_c() +@spicelock_for_multithread @spice_error_check def j1950() -> float: """ @@ -7751,6 +8087,7 @@ def j1950() -> float: return libspice.j1950_c() +@spicelock_for_multithread @spice_error_check def j2000() -> float: """ @@ -7761,6 +8098,7 @@ def j2000() -> float: return libspice.j2000_c() +@spicelock_for_multithread @spice_error_check def j2100() -> float: """ @@ -7771,6 +8109,7 @@ def j2100() -> float: return libspice.j2100_c() +@spicelock_for_multithread @spice_error_check def jyear() -> float: """ @@ -7785,6 +8124,7 @@ def jyear() -> float: # K +@spicelock_for_multithread @spice_error_check def kclear() -> None: """ @@ -7798,6 +8138,7 @@ def kclear() -> None: libspice.kclear_c() +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def kdata( @@ -7854,6 +8195,7 @@ def kdata( ) +@spicelock_for_multithread @spice_error_check def kepleq(ml: float, h: float, k: float) -> float: """ @@ -7873,6 +8215,7 @@ def kepleq(ml: float, h: float, k: float) -> float: return f +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def kinfo( @@ -7909,6 +8252,7 @@ def kinfo( ) +@spicelock_for_multithread @spice_error_check def kplfrm(frmcls: int, out_cell: Optional[SpiceCell] = None) -> SpiceCell: """ @@ -7928,6 +8272,7 @@ def kplfrm(frmcls: int, out_cell: Optional[SpiceCell] = None) -> SpiceCell: return out_cell +@spicelock_for_multithread @spice_error_check def kpsolv(evec: Tuple[float, float]) -> float: """ @@ -7945,6 +8290,7 @@ def kpsolv(evec: Tuple[float, float]) -> float: return x +@spicelock_for_multithread @spice_error_check def ktotal(kind: str) -> int: """ @@ -7962,6 +8308,7 @@ def ktotal(kind: str) -> int: return count.value +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def kxtrct( @@ -8027,6 +8374,7 @@ def kxtrct( # L +@spicelock_for_multithread @spice_error_check def lastnb(string: str) -> int: """ @@ -8042,6 +8390,7 @@ def lastnb(string: str) -> int: return libspice.lastnb_c(string) +@spicelock_for_multithread @spice_error_check def latcyl(radius: float, lon: float, lat: float) -> Tuple[float, float, float]: """ @@ -8066,6 +8415,7 @@ def latcyl(radius: float, lon: float, lat: float) -> Tuple[float, float, float]: return r.value, lonc.value, z.value +@spicelock_for_multithread @spice_error_check def latrec( radius: float, longitude: Union[float, float], latitude: Union[float, float] @@ -8088,6 +8438,7 @@ def latrec( return stypes.c_vector_to_python(rectan) +@spicelock_for_multithread @spice_error_check def latsph(radius: float, lon: float, lat: float) -> Tuple[float, float, float]: """ @@ -8112,6 +8463,7 @@ def latsph(radius: float, lon: float, lat: float) -> Tuple[float, float, float]: return rho.value, colat.value, lons.value +@spicelock_for_multithread @spice_error_check def latsrf( method: str, target: str, et: float, fixref: str, lonlat: Sequence[Sequence[float]] @@ -8143,6 +8495,7 @@ def latsrf( return stypes.c_matrix_to_numpy(srfpts) +@spicelock_for_multithread @spice_error_check def lcase(instr: str, lenout: int = _default_len_out) -> str: """ @@ -8161,6 +8514,7 @@ def lcase(instr: str, lenout: int = _default_len_out) -> str: return stypes.to_python_string(outstr) +@spicelock_for_multithread @spice_error_check def ldpool(filename: str) -> None: """ @@ -8175,6 +8529,7 @@ def ldpool(filename: str) -> None: libspice.ldpool_c(filename) +@spicelock_for_multithread @spice_error_check def limbpt( method: str, @@ -8264,6 +8619,7 @@ def limbpt( ) +@spicelock_for_multithread @spice_error_check def lgrind( xvals: Sequence[float], yvals: Sequence[float], x: float @@ -8291,6 +8647,7 @@ def lgrind( return p.value, dp.value +@spicelock_for_multithread @spice_error_check def lmpool(cvals: Union[ndarray, Iterable[str]]) -> None: """ @@ -8307,6 +8664,7 @@ def lmpool(cvals: Union[ndarray, Iterable[str]]) -> None: libspice.lmpool_c(cvals, lenvals, n) +@spicelock_for_multithread @spice_error_check def lparse(inlist: str, delim: str, nmax: int) -> Iterable[str]: """ @@ -8329,6 +8687,7 @@ def lparse(inlist: str, delim: str, nmax: int) -> Iterable[str]: return [stypes.to_python_string(x.value) for x in items[0 : n.value]] +@spicelock_for_multithread @spice_error_check def lparsm( inlist: str, delims: str, nmax: int, lenout: Optional[int] = None @@ -8357,6 +8716,7 @@ def lparsm( return [stypes.to_python_string(x.value) for x in items][0 : n.value] +@spicelock_for_multithread @spice_error_check def lparss(inlist: str, delims: str, nmax: int = 20, length: int = 50) -> SpiceCell: """ @@ -8378,6 +8738,7 @@ def lparss(inlist: str, delims: str, nmax: int = 20, length: int = 50) -> SpiceC return return_set +@spicelock_for_multithread @spice_error_check def lspcn(body: str, et: float, abcorr: str) -> float: """ @@ -8397,6 +8758,7 @@ def lspcn(body: str, et: float, abcorr: str) -> float: return libspice.lspcn_c(body, et, abcorr) +@spicelock_for_multithread @spice_error_check def lstlec(string: str, n: int, lenvals: int, array: Iterable[str]) -> int: """ @@ -8421,6 +8783,7 @@ def lstlec(string: str, n: int, lenvals: int, array: Iterable[str]) -> int: return libspice.lstlec_c(string, n, lenvals, array) +@spicelock_for_multithread @spice_error_check def lstled(x: float, n: int, array: Union[ndarray, Iterable[float]]) -> int: """ @@ -8440,6 +8803,7 @@ def lstled(x: float, n: int, array: Union[ndarray, Iterable[float]]) -> int: return libspice.lstled_c(x, n, array) +@spicelock_for_multithread @spice_error_check def lstlei(x: int, n: int, array: Union[ndarray, Iterable[int]]) -> int: """ @@ -8459,6 +8823,7 @@ def lstlei(x: int, n: int, array: Union[ndarray, Iterable[int]]) -> int: return libspice.lstlei_c(x, n, array) +@spicelock_for_multithread @spice_error_check def lstltc(string: str, n: int, lenvals: int, array: Iterable[str]) -> int: """ @@ -8483,6 +8848,7 @@ def lstltc(string: str, n: int, lenvals: int, array: Iterable[str]) -> int: return libspice.lstltc_c(string, n, lenvals, array) +@spicelock_for_multithread @spice_error_check def lstltd(x: float, n: int, array: Union[ndarray, Iterable[float]]) -> int: """ @@ -8502,6 +8868,7 @@ def lstltd(x: float, n: int, array: Union[ndarray, Iterable[float]]) -> int: return libspice.lstltd_c(x, n, array) +@spicelock_for_multithread @spice_error_check def lstlti(x: int, n: int, array: Union[ndarray, Iterable[int]]) -> int: """ @@ -8521,6 +8888,7 @@ def lstlti(x: int, n: int, array: Union[ndarray, Iterable[int]]) -> int: return libspice.lstlti_c(x, n, array) +@spicelock_for_multithread @spice_error_check def ltime(etobs: float, obs: int, direct: str, targ: int) -> Tuple[float, float]: """ @@ -8549,6 +8917,7 @@ def ltime(etobs: float, obs: int, direct: str, targ: int) -> Tuple[float, float] return ettarg.value, elapsd.value +@spicelock_for_multithread @spice_error_check def lx4dec(string: str, first: int) -> Tuple[int, int]: """ @@ -8569,6 +8938,7 @@ def lx4dec(string: str, first: int) -> Tuple[int, int]: return last.value, nchar.value +@spicelock_for_multithread @spice_error_check def lx4num(string: str, first: int) -> Tuple[int, int]: """ @@ -8589,6 +8959,7 @@ def lx4num(string: str, first: int) -> Tuple[int, int]: return last.value, nchar.value +@spicelock_for_multithread @spice_error_check def lx4sgn(string: str, first: int) -> Tuple[int, int]: """ @@ -8609,6 +8980,7 @@ def lx4sgn(string: str, first: int) -> Tuple[int, int]: return last.value, nchar.value +@spicelock_for_multithread @spice_error_check def lx4uns(string: str, first: int) -> Tuple[int, int]: """ @@ -8629,6 +9001,7 @@ def lx4uns(string: str, first: int) -> Tuple[int, int]: return last.value, nchar.value +@spicelock_for_multithread @spice_error_check def lxqstr(string: str, qchar: str, first: int) -> Tuple[int, int]: """ @@ -8654,6 +9027,7 @@ def lxqstr(string: str, qchar: str, first: int) -> Tuple[int, int]: # M +@spicelock_for_multithread @spice_error_check def m2eul( r: Union[ndarray, Iterable[Iterable[float]]], axis3: int, axis2: int, axis1: int @@ -8689,6 +9063,7 @@ def m2eul( return angle3.value, angle2.value, angle1.value +@spicelock_for_multithread @spice_error_check def m2q(r: ndarray) -> ndarray: """ @@ -8705,6 +9080,7 @@ def m2q(r: ndarray) -> ndarray: return stypes.c_vector_to_python(q) +@spicelock_for_multithread @spice_error_check def matchi(string: str, templ: str, wstr: str, wchr: str) -> bool: """ @@ -8726,6 +9102,7 @@ def matchi(string: str, templ: str, wstr: str, wchr: str) -> bool: return bool(libspice.matchi_c(string, templ, wstr, wchr)) +@spicelock_for_multithread @spice_error_check def matchw(string: str, templ: str, wstr: str, wchr: str) -> bool: # ctypes.c_char(wstr.encode(encoding='UTF-8') @@ -8755,6 +9132,7 @@ def matchw(string: str, templ: str, wstr: str, wchr: str) -> bool: # odd as arguments must be parsed and not really important +@spicelock_for_multithread @spice_error_check def mequ(m1: ndarray) -> ndarray: """ @@ -8771,6 +9149,7 @@ def mequ(m1: ndarray) -> ndarray: return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def mequg(m1: ndarray, nr: int, nc: int) -> ndarray: """ @@ -8799,6 +9178,7 @@ def mequg(m1: ndarray, nr: int, nc: int) -> ndarray: # odd as arguments must be parsed and not really important +@spicelock_for_multithread @spice_error_check def mtxm(m1: ndarray, m2: ndarray) -> ndarray: """ @@ -8817,6 +9197,7 @@ def mtxm(m1: ndarray, m2: ndarray) -> ndarray: return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def mtxmg( m1: ndarray, @@ -8851,6 +9232,7 @@ def mtxmg( return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def mtxv(m1: ndarray, vin: ndarray) -> ndarray: """ @@ -8870,6 +9252,7 @@ def mtxv(m1: ndarray, vin: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def mtxvg( m1: ndarray, v2: ndarray, ncol1: OptionalInt = None, nr1r2: OptionalInt = None @@ -8898,6 +9281,7 @@ def mtxvg( return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def mxm( m1: Union[ndarray, Iterable[Iterable[float]]], @@ -8919,6 +9303,7 @@ def mxm( return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def mxmg( m1: Union[ndarray, Iterable[Iterable[float]]], @@ -8951,6 +9336,7 @@ def mxmg( return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def mxmt( m1: Union[ndarray, Iterable[Iterable[float]]], @@ -8972,6 +9358,7 @@ def mxmt( return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def mxmtg(m1: Union[ndarray, Iterable[Iterable[float]]], m2: Union[ndarray, Iterable[Iterable[float]]], nrow1: OptionalInt = None, nc1c2: OptionalInt = None, nrow2: OptionalInt = None) -> ndarray: """ @@ -8998,6 +9385,7 @@ def mxmtg(m1: Union[ndarray, Iterable[Iterable[float]]], m2: Union[ndarray, Iter return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def mxv(m1: ndarray, vin: ndarray) -> ndarray: """ @@ -9017,6 +9405,7 @@ def mxv(m1: ndarray, vin: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def mxvg(m1: Union[ndarray, Iterable[Iterable[float]]], v2: Union[ndarray, Iterable[Iterable[float]]], nrow1: OptionalInt = None, nc1r2: OptionalInt = None) -> ndarray: """ @@ -9045,6 +9434,7 @@ def mxvg(m1: Union[ndarray, Iterable[Iterable[float]]], v2: Union[ndarray, Itera # N +@spicelock_for_multithread @spice_error_check def namfrm(frname: str) -> int: """ @@ -9061,6 +9451,7 @@ def namfrm(frname: str) -> int: return frcode.value +@spicelock_for_multithread @spice_error_check def ncpos(string: str, chars: str, start: int) -> int: """ @@ -9081,6 +9472,7 @@ def ncpos(string: str, chars: str, start: int) -> int: return libspice.ncpos_c(string, chars, start) +@spicelock_for_multithread @spice_error_check def ncposr(string: str, chars: str, start: int) -> int: """ @@ -9101,6 +9493,7 @@ def ncposr(string: str, chars: str, start: int) -> int: return libspice.ncposr_c(string, chars, start) +@spicelock_for_multithread @spice_error_check def nearpt( positn: Union[ndarray, Iterable[float]], a: float, b: float, c: float @@ -9130,6 +9523,7 @@ def nearpt( return stypes.c_vector_to_python(npoint), alt.value +@spicelock_for_multithread @spice_error_check def npedln( a: float, @@ -9162,6 +9556,7 @@ def npedln( return stypes.c_vector_to_python(pnear), dist.value +@spicelock_for_multithread @spice_error_check def npelpt( point: Union[ndarray, Iterable[float]], ellips: Ellipse @@ -9184,6 +9579,7 @@ def npelpt( return stypes.c_vector_to_python(pnear), dist.value +@spicelock_for_multithread @spice_error_check def nplnpt( linpt: Union[ndarray, Iterable[float]], @@ -9212,6 +9608,7 @@ def nplnpt( return stypes.c_vector_to_python(pnear), dist.value +@spicelock_for_multithread @spice_error_check def nvc2pl(normal: Union[Iterable[float], Iterable[float]], constant: float) -> Plane: """ @@ -9230,6 +9627,7 @@ def nvc2pl(normal: Union[Iterable[float], Iterable[float]], constant: float) -> return plane +@spicelock_for_multithread @spice_error_check def nvp2pl( normal: Union[ndarray, Iterable[float]], point: Union[ndarray, Iterable[float]] @@ -9254,6 +9652,7 @@ def nvp2pl( # O +@spicelock_for_multithread @spice_error_check def occult( target1: str, @@ -9309,6 +9708,7 @@ def occult( return occult_code.value +@spicelock_for_multithread @spice_error_check def ordc(item: str, inset: SpiceCell) -> int: """ @@ -9329,6 +9729,7 @@ def ordc(item: str, inset: SpiceCell) -> int: return libspice.ordc_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def ordd(item: float, inset: SpiceCell) -> int: """ @@ -9348,6 +9749,7 @@ def ordd(item: float, inset: SpiceCell) -> int: return libspice.ordd_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def ordi(item: int, inset: SpiceCell) -> int: """ @@ -9368,6 +9770,7 @@ def ordi(item: int, inset: SpiceCell) -> int: return libspice.ordi_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def orderc(array: Sequence[str], ndim: Optional[int] = None) -> ndarray: """ @@ -9390,6 +9793,7 @@ def orderc(array: Sequence[str], ndim: Optional[int] = None) -> ndarray: return stypes.c_vector_to_python(iorder) +@spicelock_for_multithread @spice_error_check def orderd(array: Sequence[float], ndim: Optional[int] = None) -> ndarray: """ @@ -9411,6 +9815,7 @@ def orderd(array: Sequence[float], ndim: Optional[int] = None) -> ndarray: return stypes.c_vector_to_python(iorder) +@spicelock_for_multithread @spice_error_check def orderi(array: Sequence[int], ndim: Optional[int] = None) -> ndarray: """ @@ -9432,6 +9837,7 @@ def orderi(array: Sequence[int], ndim: Optional[int] = None) -> ndarray: return stypes.c_vector_to_python(iorder) +@spicelock_for_multithread @spice_error_check def oscelt(state: ndarray, et: float, mu: Union[float, int]) -> ndarray: """ @@ -9478,6 +9884,7 @@ def oscltx(state: ndarray, et: float, mu: int) -> ndarray: ################################################################################ # P +@spicelock_for_multithread @spice_error_check def pckcls(handle: int) -> None: """ @@ -9491,6 +9898,7 @@ def pckcls(handle: int) -> None: libspice.pckcls_c(handle) +@spicelock_for_multithread @spice_error_check def pckcov(pck: str, idcode: int, cover: SpiceCell) -> None: """ @@ -9510,6 +9918,7 @@ def pckcov(pck: str, idcode: int, cover: SpiceCell) -> None: libspice.pckcov_c(pck, idcode, ctypes.byref(cover)) +@spicelock_for_multithread @spice_error_check def pckfrm(pck: str, ids: SpiceCell) -> None: """ @@ -9527,6 +9936,7 @@ def pckfrm(pck: str, ids: SpiceCell) -> None: libspice.pckfrm_c(pck, ctypes.byref(ids)) +@spicelock_for_multithread @spice_error_check def pcklof(filename: str) -> int: """ @@ -9545,6 +9955,7 @@ def pcklof(filename: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def pckopn(name: str, ifname: str, ncomch: int) -> int: """ @@ -9565,6 +9976,7 @@ def pckopn(name: str, ifname: str, ncomch: int) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def pckuof(handle: int) -> None: """ @@ -9579,6 +9991,7 @@ def pckuof(handle: int) -> None: libspice.pckuof_c(handle) +@spicelock_for_multithread @spice_error_check def pckw02( handle: int, @@ -9628,6 +10041,7 @@ def pckw02( ) +@spicelock_for_multithread @spice_error_check def pcpool(name: str, cvals: Sequence[str]) -> None: """ @@ -9647,6 +10061,7 @@ def pcpool(name: str, cvals: Sequence[str]) -> None: libspice.pcpool_c(name, n, lenvals, cvals) +@spicelock_for_multithread @spice_error_check def pdpool(name: str, dvals: Union[ndarray, Iterable[float]]) -> None: """ @@ -9665,6 +10080,7 @@ def pdpool(name: str, dvals: Union[ndarray, Iterable[float]]) -> None: libspice.pdpool_c(name, n, dvals) +@spicelock_for_multithread @spice_error_check def pgrrec(body: str, lon: float, lat: float, alt: int, re: float, f: float) -> ndarray: """ @@ -9691,6 +10107,7 @@ def pgrrec(body: str, lon: float, lat: float, alt: int, re: float, f: float) -> return stypes.c_vector_to_python(rectan) +@spicelock_for_multithread @spice_error_check def phaseq(et: float, target: str, illmn: str, obsrvr: str, abcorr: str) -> float: """ @@ -9714,6 +10131,7 @@ def phaseq(et: float, target: str, illmn: str, obsrvr: str, abcorr: str) -> floa return libspice.phaseq_c(et, target, illmn, obsrvr, abcorr) +@spicelock_for_multithread @spice_error_check def pi() -> float: """ @@ -9727,6 +10145,7 @@ def pi() -> float: return libspice.pi_c() +@spicelock_for_multithread @spice_error_check def pipool(name: str, ivals: ndarray) -> None: """ @@ -9744,6 +10163,7 @@ def pipool(name: str, ivals: ndarray) -> None: libspice.pipool_c(name, n, ivals) +@spicelock_for_multithread @spice_error_check def pjelpl(elin: Ellipse, plane: Plane) -> Ellipse: """ @@ -9762,6 +10182,7 @@ def pjelpl(elin: Ellipse, plane: Plane) -> Ellipse: return elout +@spicelock_for_multithread @spice_error_check def pl2nvc(plane: Plane) -> Tuple[ndarray, float]: """ @@ -9781,6 +10202,7 @@ def pl2nvc(plane: Plane) -> Tuple[ndarray, float]: return stypes.c_vector_to_python(normal), constant.value +@spicelock_for_multithread @spice_error_check def pl2nvp(plane: Plane) -> Tuple[ndarray, ndarray]: """ @@ -9799,6 +10221,7 @@ def pl2nvp(plane: Plane) -> Tuple[ndarray, ndarray]: return stypes.c_vector_to_python(normal), stypes.c_vector_to_python(point) +@spicelock_for_multithread @spice_error_check def pl2psv(plane: Plane) -> Tuple[ndarray, ndarray, ndarray]: """ @@ -9824,6 +10247,7 @@ def pl2psv(plane: Plane) -> Tuple[ndarray, ndarray, ndarray]: ) +@spicelock_for_multithread @spice_error_check def pltar(vrtces: Sequence[Iterable[float]], plates: Sequence[Iterable[int]]) -> float: """ @@ -9842,6 +10266,7 @@ def pltar(vrtces: Sequence[Iterable[float]], plates: Sequence[Iterable[int]]) -> return libspice.pltar_c(nv, vrtces, np, plates) +@spicelock_for_multithread @spice_error_check def pltexp( iverts: Iterable[Union[Iterable[Union[float, float]], Iterable[float]]], @@ -9865,6 +10290,7 @@ def pltexp( return stypes.c_matrix_to_numpy(overts) +@spicelock_for_multithread @spice_error_check def pltnp( point: Union[ndarray, Iterable[float]], @@ -9893,6 +10319,7 @@ def pltnp( return stypes.c_vector_to_python(pnear), dist.value +@spicelock_for_multithread @spice_error_check def pltnrm( v1: Iterable[Union[float, float]], @@ -9918,6 +10345,7 @@ def pltnrm( return stypes.c_vector_to_python(normal) +@spicelock_for_multithread @spice_error_check def pltvol(vrtces: Sequence[Iterable[float]], plates: Sequence[Iterable[int]]) -> float: """ @@ -9937,6 +10365,7 @@ def pltvol(vrtces: Sequence[Iterable[float]], plates: Sequence[Iterable[int]]) - return libspice.pltvol_c(nv, vrtces, np, plates) +@spicelock_for_multithread @spice_error_check def polyds( coeffs: Union[ndarray, Iterable[float]], deg: int, nderiv: int, t: int @@ -9962,6 +10391,7 @@ def polyds( return stypes.c_vector_to_python(p) +@spicelock_for_multithread @spice_error_check def pos(string: str, substr: str, start: int) -> int: """ @@ -9983,6 +10413,7 @@ def pos(string: str, substr: str, start: int) -> int: return libspice.pos_c(string, substr, start) +@spicelock_for_multithread @spice_error_check def posr(string: str, substr: str, start: int) -> int: """ @@ -10008,6 +10439,7 @@ def posr(string: str, substr: str, start: int) -> int: # skip for no as this is not really an important function for python users +@spicelock_for_multithread @spice_error_check def prop2b(gm: float, pvinit: ndarray, dt: float) -> ndarray: """ @@ -10030,6 +10462,7 @@ def prop2b(gm: float, pvinit: ndarray, dt: float) -> ndarray: return stypes.c_vector_to_python(pvprop) +@spicelock_for_multithread @spice_error_check def prsdp(string: str) -> float: """ @@ -10046,6 +10479,7 @@ def prsdp(string: str) -> float: return dpval.value +@spicelock_for_multithread @spice_error_check def prsint(string: str) -> int: """ @@ -10062,6 +10496,7 @@ def prsint(string: str) -> int: return intval.value +@spicelock_for_multithread @spice_error_check def psv2pl(point: ndarray, span1: ndarray, span2: ndarray) -> Plane: """ @@ -10085,6 +10520,7 @@ def psv2pl(point: ndarray, span1: ndarray, span2: ndarray) -> Plane: # skip putcml, is this really needed for python users? +@spicelock_for_multithread @spice_error_check def pxform(fromstr: str, tostr: str, et: float) -> ndarray: """ @@ -10106,6 +10542,7 @@ def pxform(fromstr: str, tostr: str, et: float) -> ndarray: return stypes.c_matrix_to_numpy(rotatematrix) +@spicelock_for_multithread @spice_error_check def pxfrm2(frame_from: str, frame_to: str, etfrom: float, etto: float) -> ndarray: """ @@ -10134,6 +10571,7 @@ def pxfrm2(frame_from: str, frame_to: str, etfrom: float, etto: float) -> ndarra # Q +@spicelock_for_multithread @spice_error_check def q2m(q: ndarray) -> ndarray: """ @@ -10150,7 +10588,8 @@ def q2m(q: ndarray) -> ndarray: return stypes.c_matrix_to_numpy(mout) -# @spice_error_check +@spicelock_for_multithread +# @spice_error_check # Commented in order to avoid RecursionError def qcktrc(tracelen: int = _default_len_out) -> str: """ Return a string containing a traceback. @@ -10166,6 +10605,7 @@ def qcktrc(tracelen: int = _default_len_out) -> str: return stypes.to_python_string(tracestr) +@spicelock_for_multithread @spice_error_check def qdq2av(q: ndarray, dq: Union[ndarray, Iterable[float]]) -> ndarray: """ @@ -10185,6 +10625,7 @@ def qdq2av(q: ndarray, dq: Union[ndarray, Iterable[float]]) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def qxq( q1: Union[ndarray, Iterable[float]], q2: Union[ndarray, Iterable[float]] @@ -10209,6 +10650,7 @@ def qxq( # R +@spicelock_for_multithread @spice_error_check def radrec(inrange: float, re: float, dec: float) -> ndarray: """ @@ -10230,6 +10672,7 @@ def radrec(inrange: float, re: float, dec: float) -> ndarray: return stypes.c_vector_to_python(rectan) +@spicelock_for_multithread @spice_error_check def rav2xf( rot: Union[ndarray, Iterable[Iterable[float]]], av: Union[ndarray, Iterable[float]] @@ -10252,6 +10695,7 @@ def rav2xf( return stypes.c_matrix_to_numpy(xform) +@spicelock_for_multithread @spice_error_check def raxisa(matrix: ndarray) -> Tuple[ndarray, float]: """ @@ -10270,6 +10714,7 @@ def raxisa(matrix: ndarray) -> Tuple[ndarray, float]: return stypes.c_vector_to_python(axis), angle.value +@spicelock_for_multithread @spice_error_check def rdtext( file: str, lenout: int = _default_len_out @@ -10291,6 +10736,7 @@ def rdtext( return stypes.to_python_string(line), bool(eof.value) +@spicelock_for_multithread @spice_error_check def reccyl(rectan: Union[ndarray, Iterable[float]]) -> Tuple[float, float, float]: """ @@ -10312,6 +10758,7 @@ def reccyl(rectan: Union[ndarray, Iterable[float]]) -> Tuple[float, float, float return radius.value, lon.value, z.value +@spicelock_for_multithread @spice_error_check def recgeo( rectan: Union[ndarray, Iterable[float]], re: float, f: float @@ -10346,6 +10793,7 @@ def recgeo( return longitude.value, latitude.value, alt.value +@spicelock_for_multithread @spice_error_check def reclat(rectan: Union[ndarray, Iterable[float]]) -> Tuple[float, float, float]: """ @@ -10366,6 +10814,7 @@ def reclat(rectan: Union[ndarray, Iterable[float]]) -> Tuple[float, float, float return radius.value, longitude.value, latitude.value +@spicelock_for_multithread @spice_error_check def recpgr( body: str, rectan: Union[ndarray, Iterable[float]], re: float, f: float @@ -10397,6 +10846,7 @@ def recpgr( return lon.value, lat.value, alt.value +@spicelock_for_multithread @spice_error_check def recrad(rectan: Union[ndarray, Iterable[float]]) -> Tuple[float, float, float]: """ @@ -10420,6 +10870,7 @@ def recrad(rectan: Union[ndarray, Iterable[float]]) -> Tuple[float, float, float return outrange.value, ra.value, dec.value +@spicelock_for_multithread @spice_error_check def recsph(rectan: ndarray) -> Tuple[float, float, float]: """ @@ -10441,6 +10892,7 @@ def recsph(rectan: ndarray) -> Tuple[float, float, float]: return r.value, colat.value, lon.value +@spicelock_for_multithread @spice_error_check def removc(item: str, inset: SpiceCell) -> None: """ @@ -10457,6 +10909,7 @@ def removc(item: str, inset: SpiceCell) -> None: libspice.removc_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def removd(item: float, inset: SpiceCell) -> None: """ @@ -10473,6 +10926,7 @@ def removd(item: float, inset: SpiceCell) -> None: libspice.removd_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def removi(item: int, inset: SpiceCell) -> None: """ @@ -10489,6 +10943,7 @@ def removi(item: int, inset: SpiceCell) -> None: libspice.removi_c(item, ctypes.byref(inset)) +@spicelock_for_multithread @spice_error_check def reordc( iorder: Union[ndarray, Iterable[int]], ndim: int, lenvals: int, array: Iterable[str] @@ -10513,6 +10968,7 @@ def reordc( return [stypes.to_python_string(x.value) for x in array] +@spicelock_for_multithread @spice_error_check def reordd( iorder: Union[ndarray, Iterable[int]], @@ -10537,6 +10993,7 @@ def reordd( return stypes.c_vector_to_python(array) +@spicelock_for_multithread @spice_error_check def reordi( iorder: Union[ndarray, Iterable[int]], @@ -10561,6 +11018,7 @@ def reordi( return stypes.c_vector_to_python(array) +@spicelock_for_multithread @spice_error_check def reordl( iorder: Union[ndarray, Iterable[int]], ndim: int, array: Iterable[bool] @@ -10583,6 +11041,7 @@ def reordl( return stypes.c_int_vector_to_bool_python(array) +@spicelock_for_multithread @spice_error_check def repmc(instr: str, marker: str, value: str, lenout: Optional[int] = None) -> str: """ @@ -10606,6 +11065,7 @@ def repmc(instr: str, marker: str, value: str, lenout: Optional[int] = None) -> return stypes.to_python_string(out) +@spicelock_for_multithread @spice_error_check def repmct( instr: str, marker: str, value: int, repcase: str, lenout: Optional[int] = None @@ -10634,6 +11094,7 @@ def repmct( return stypes.to_python_string(out) +@spicelock_for_multithread @spice_error_check def repmd(instr: str, marker: str, value: float, sigdig: int) -> str: """ @@ -10657,6 +11118,7 @@ def repmd(instr: str, marker: str, value: float, sigdig: int) -> str: return stypes.to_python_string(out) +@spicelock_for_multithread @spice_error_check def repmf( instr: str, @@ -10691,6 +11153,7 @@ def repmf( return stypes.to_python_string(out) +@spicelock_for_multithread @spice_error_check def repmi(instr: str, marker: str, value: int, lenout: Optional[int] = None) -> str: """ @@ -10714,6 +11177,7 @@ def repmi(instr: str, marker: str, value: int, lenout: Optional[int] = None) -> return stypes.to_python_string(out) +@spicelock_for_multithread @spice_error_check def repmot( instr: str, marker: str, value: int, repcase: str, lenout: Optional[int] = None @@ -10753,6 +11217,7 @@ def reset() -> None: libspice.reset_c() +@spicelock_for_multithread @spice_error_check def return_c() -> bool: """ @@ -10765,6 +11230,7 @@ def return_c() -> bool: return bool(libspice.return_c()) +@spicelock_for_multithread @spice_error_check def rotate(angle: float, iaxis: int) -> ndarray: """ @@ -10785,6 +11251,7 @@ def rotate(angle: float, iaxis: int) -> ndarray: return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def rotmat(m1: ndarray, angle: float, iaxis: int) -> ndarray: """ @@ -10807,6 +11274,7 @@ def rotmat(m1: ndarray, angle: float, iaxis: int) -> ndarray: return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def rotvec(v1: Iterable[Union[float, float]], angle: float, iaxis: int) -> ndarray: """ @@ -10829,6 +11297,7 @@ def rotvec(v1: Iterable[Union[float, float]], angle: float, iaxis: int) -> ndarr return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def rpd() -> float: """ @@ -10841,6 +11310,7 @@ def rpd() -> float: return libspice.rpd_c() +@spicelock_for_multithread @spice_error_check def rquad(a: float, b: float, c: float) -> Tuple[ndarray, ndarray]: """ @@ -10866,6 +11336,7 @@ def rquad(a: float, b: float, c: float) -> Tuple[ndarray, ndarray]: # S +@spicelock_for_multithread @spice_error_check def saelgv( vec1: Union[ndarray, Iterable[float]], vec2: Union[ndarray, Iterable[float]] @@ -10888,6 +11359,7 @@ def saelgv( return stypes.c_vector_to_python(smajor), stypes.c_vector_to_python(sminor) +@spicelock_for_multithread @spice_error_check def scard(incard: int, cell: SpiceCell) -> SpiceCell: """ @@ -10905,6 +11377,7 @@ def scard(incard: int, cell: SpiceCell) -> SpiceCell: return cell +@spicelock_for_multithread @spice_error_check def scdecd( sc: int, sclkdp: float, lenout: int = _default_len_out, mxpart: Optional[int] = None @@ -10930,6 +11403,7 @@ def scdecd( return stypes.to_python_string(sclkch) +@spicelock_for_multithread @spice_error_check def sce2c(sc: int, et: float) -> float: """ @@ -10952,6 +11426,7 @@ def sce2c(sc: int, et: float) -> float: return sclkdp.value +@spicelock_for_multithread @spice_error_check def sce2s(sc: int, et: float, lenout: int = _default_len_out) -> str: """ @@ -10973,6 +11448,7 @@ def sce2s(sc: int, et: float, lenout: int = _default_len_out) -> str: return stypes.to_python_string(sclkch) +@spicelock_for_multithread @spice_error_check def sce2t(sc: int, et: float) -> float: """ @@ -10994,6 +11470,7 @@ def sce2t(sc: int, et: float) -> float: return sclkdp.value +@spicelock_for_multithread @spice_error_check def scencd( sc: int, sclkch: Union[str, Iterable[str]], mxpart: Optional[int] = None @@ -11023,6 +11500,7 @@ def scencd( return sclkdp.value +@spicelock_for_multithread @spice_error_check def scfmt(sc: int, ticks: float, lenout: int = _default_len_out) -> str: """ @@ -11043,6 +11521,7 @@ def scfmt(sc: int, ticks: float, lenout: int = _default_len_out) -> str: return stypes.to_python_string(clkstr) +@spicelock_for_multithread @spice_error_check def scpart(sc: int) -> Tuple[ndarray, ndarray]: """ @@ -11068,6 +11547,7 @@ def scpart(sc: int) -> Tuple[ndarray, ndarray]: ) +@spicelock_for_multithread @spice_error_check def scs2e(sc: int, sclkch: str) -> float: """ @@ -11086,6 +11566,7 @@ def scs2e(sc: int, sclkch: str) -> float: return et.value +@spicelock_for_multithread @spice_error_check def sct2e(sc: int, sclkdp: Union[float, Iterable[float]]) -> Union[float, ndarray]: """ @@ -11113,6 +11594,7 @@ def sct2e(sc: int, sclkdp: Union[float, Iterable[float]]) -> Union[float, ndarra return et.value +@spicelock_for_multithread @spice_error_check def sctiks(sc: int, clkstr: str) -> float: """ @@ -11131,6 +11613,7 @@ def sctiks(sc: int, clkstr: str) -> float: return ticks.value +@spicelock_for_multithread @spice_error_check def sdiff(a: SpiceCell, b: SpiceCell) -> SpiceCell: """ @@ -11160,6 +11643,7 @@ def sdiff(a: SpiceCell, b: SpiceCell) -> SpiceCell: return c +@spicelock_for_multithread @spice_error_check def set_c(a: SpiceCell, op: str, b: SpiceCell) -> bool: """ @@ -11180,6 +11664,7 @@ def set_c(a: SpiceCell, op: str, b: SpiceCell) -> bool: return bool(libspice.set_c(ctypes.byref(a), op, ctypes.byref(b))) +@spicelock_for_multithread @spice_error_check def setmsg(message: str) -> None: """ @@ -11193,6 +11678,7 @@ def setmsg(message: str) -> None: libspice.setmsg_c(message) +@spicelock_for_multithread @spice_error_check def shellc(ndim: int, lenvals: int, array: Iterable[str]) -> Iterable[str]: # This works! looks like this is a mutable 2d char array @@ -11214,6 +11700,7 @@ def shellc(ndim: int, lenvals: int, array: Iterable[str]) -> Iterable[str]: return stypes.c_vector_to_python(array) +@spicelock_for_multithread @spice_error_check def shelld(ndim: int, array: Union[ndarray, Iterable[float]]) -> ndarray: # Works!, use this as example for "I/O" parameters @@ -11232,6 +11719,7 @@ def shelld(ndim: int, array: Union[ndarray, Iterable[float]]) -> ndarray: return stypes.c_vector_to_python(array) +@spicelock_for_multithread @spice_error_check def shelli(ndim: int, array: Union[ndarray, Iterable[int]]) -> ndarray: # Works!, use this as example for "I/O" parameters @@ -11263,6 +11751,7 @@ def sigerr(message: str) -> None: libspice.sigerr_c(message) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def sincpt( @@ -11332,6 +11821,7 @@ def sincpt( ) +@spicelock_for_multithread @spice_error_check def size(cell: SpiceCell) -> int: """ @@ -11347,6 +11837,7 @@ def size(cell: SpiceCell) -> int: return libspice.size_c(ctypes.byref(cell)) +@spicelock_for_multithread @spice_error_check def spd() -> float: """ @@ -11359,6 +11850,7 @@ def spd() -> float: return libspice.spd_c() +@spicelock_for_multithread @spice_error_check def sphcyl(radius: float, colat: float, slon: float) -> Tuple[float, float, float]: """ @@ -11387,6 +11879,7 @@ def sphcyl(radius: float, colat: float, slon: float) -> Tuple[float, float, floa return r.value, lon.value, z.value +@spicelock_for_multithread @spice_error_check def sphlat(r: float, colat: float, lons: float) -> Tuple[float, float, float]: """ @@ -11414,6 +11907,7 @@ def sphlat(r: float, colat: float, lons: float) -> Tuple[float, float, float]: return radius.value, lon.value, lat.value +@spicelock_for_multithread @spice_error_check def sphrec(r: float, colat: float, lon: float) -> ndarray: """ @@ -11434,6 +11928,7 @@ def sphrec(r: float, colat: float, lon: float) -> ndarray: return stypes.c_vector_to_python(rectan) +@spicelock_for_multithread @spice_error_check def spkacs( targ: int, et: float, ref: str, abcorr: str, obs: int @@ -11470,6 +11965,7 @@ def spkacs( return stypes.c_vector_to_python(starg), lt.value, dlt.value +@spicelock_for_multithread @spice_error_check def spkapo( targ: int, et: float, ref: str, sobs: ndarray, abcorr: str @@ -11500,6 +11996,7 @@ def spkapo( return stypes.c_vector_to_python(ptarg), lt.value +@spicelock_for_multithread @spice_error_check def spkapp( targ: int, et: float, ref: str, sobs: ndarray, abcorr: str @@ -11534,6 +12031,7 @@ def spkapp( return stypes.c_vector_to_python(starg), lt.value +@spicelock_for_multithread @spice_error_check def spkaps( targ: int, @@ -11582,6 +12080,7 @@ def spkaps( return stypes.c_vector_to_python(starg), lt.value, dlt.value +@spicelock_for_multithread @spice_error_check def spk14a( handle: int, @@ -11607,6 +12106,7 @@ def spk14a( libspice.spk14a_c(handle, ncsets, coeffs, epochs) +@spicelock_for_multithread @spice_error_check def spk14b( handle: int, @@ -11644,6 +12144,7 @@ def spk14b( libspice.spk14b_c(handle, segid, body, center, framename, first, last, chbdeg) +@spicelock_for_multithread @spice_error_check def spk14e(handle: int) -> None: """ @@ -11658,6 +12159,7 @@ def spk14e(handle: int) -> None: libspice.spk14e_c(handle) +@spicelock_for_multithread @spice_error_check def spkcls(handle: int) -> None: """ @@ -11671,6 +12173,7 @@ def spkcls(handle: int) -> None: libspice.spkcls_c(handle) +@spicelock_for_multithread @spice_error_check def spkcov(spk: str, idcode: int, cover: Optional[SpiceCell] = None) -> SpiceCell: """ @@ -11694,6 +12197,7 @@ def spkcov(spk: str, idcode: int, cover: Optional[SpiceCell] = None) -> SpiceCel return cover +@spicelock_for_multithread @spice_error_check def spkcpo( target: str, @@ -11750,6 +12254,7 @@ def spkcpo( return stypes.c_vector_to_python(state), lt.value +@spicelock_for_multithread @spice_error_check def spkcpt( trgpos: Union[ndarray, Iterable[float]], @@ -11806,6 +12311,7 @@ def spkcpt( return stypes.c_vector_to_python(state), lt.value +@spicelock_for_multithread @spice_error_check def spkcvo( target: str, @@ -11866,6 +12372,7 @@ def spkcvo( return stypes.c_vector_to_python(state), lt.value +@spicelock_for_multithread @spice_error_check def spkcvt( trgsta: Union[ndarray, Iterable[float]], @@ -11926,6 +12433,7 @@ def spkcvt( return stypes.c_vector_to_python(state), lt.value +@spicelock_for_multithread @spice_error_check def spkez( targ: int, et: float, ref: str, abcorr: str, obs: int @@ -11957,6 +12465,7 @@ def spkez( return stypes.c_vector_to_python(starg), lt.value +@spicelock_for_multithread @spice_error_check def spkezp( targ: int, et: float, ref: str, abcorr: str, obs: int @@ -11988,6 +12497,7 @@ def spkezp( return stypes.c_vector_to_python(ptarg), lt.value +@spicelock_for_multithread @spice_error_check def spkezr( targ: str, et: Union[ndarray, float], ref: str, abcorr: str, obs: str @@ -12032,6 +12542,7 @@ def spkezr( return stypes.c_vector_to_python(starg), lt.value +@spicelock_for_multithread @spice_error_check def spkgeo(targ: int, et: float, ref: str, obs: int) -> Tuple[ndarray, float]: """ @@ -12056,6 +12567,7 @@ def spkgeo(targ: int, et: float, ref: str, obs: int) -> Tuple[ndarray, float]: return stypes.c_vector_to_python(state), lt.value +@spicelock_for_multithread @spice_error_check def spkgps(targ: int, et: float, ref: str, obs: int) -> Tuple[ndarray, float]: """ @@ -12080,6 +12592,7 @@ def spkgps(targ: int, et: float, ref: str, obs: int) -> Tuple[ndarray, float]: return stypes.c_vector_to_python(position), lt.value +@spicelock_for_multithread @spice_error_check def spklef(filename: str) -> int: """ @@ -12097,6 +12610,7 @@ def spklef(filename: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def spkltc( targ: int, et: float, ref: str, abcorr: str, stobs: ndarray @@ -12132,6 +12646,7 @@ def spkltc( return stypes.c_vector_to_python(starg), lt.value, dlt.value +@spicelock_for_multithread @spice_error_check def spkobj(spk: str, out_cell: Optional[SpiceCell] = None) -> SpiceCell: """ @@ -12151,6 +12666,7 @@ def spkobj(spk: str, out_cell: Optional[SpiceCell] = None) -> SpiceCell: return out_cell +@spicelock_for_multithread @spice_error_check def spkopa(filename: str) -> int: """ @@ -12167,6 +12683,7 @@ def spkopa(filename: str) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def spkopn(filename: str, ifname: str, ncomch: int) -> int: """ @@ -12187,6 +12704,7 @@ def spkopn(filename: str, ifname: str, ncomch: int) -> int: return handle.value +@spicelock_for_multithread @spice_error_check def spkpds( body: int, center: int, framestr: str, typenum: int, first: float, last: float @@ -12216,6 +12734,7 @@ def spkpds( return stypes.c_vector_to_python(descr) +@spicelock_for_multithread @spice_error_check def spkpos( targ: str, et: Union[float, ndarray], ref: str, abcorr: str, obs: str @@ -12256,6 +12775,7 @@ def spkpos( return stypes.c_vector_to_python(ptarg), lt.value +@spicelock_for_multithread @spice_error_check def spkpvn(handle: int, descr: ndarray, et: float) -> Tuple[int, ndarray, int]: """ @@ -12283,6 +12803,7 @@ def spkpvn(handle: int, descr: ndarray, et: float) -> Tuple[int, ndarray, int]: return ref.value, stypes.c_vector_to_python(state), center.value +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def spksfs(body: int, et: float, idlen: int) -> Tuple[int, ndarray, str, bool]: @@ -12320,6 +12841,7 @@ def spksfs(body: int, et: float, idlen: int) -> Tuple[int, ndarray, str, bool]: ) +@spicelock_for_multithread @spice_error_check def spkssb(targ: int, et: float, ref: str) -> ndarray: """ @@ -12341,6 +12863,7 @@ def spkssb(targ: int, et: float, ref: str) -> ndarray: return stypes.c_vector_to_python(starg) +@spicelock_for_multithread @spice_error_check def spksub( handle: int, descr: ndarray, identin: str, begin: float, end: float, newh: int @@ -12368,6 +12891,7 @@ def spksub( libspice.spksub_c(handle, descr, identin, begin, end, newh) +@spicelock_for_multithread @spice_error_check def spkuds(descr: ndarray) -> Tuple[int, int, int, int, float, float, int, int]: """ @@ -12419,6 +12943,7 @@ def spkuds(descr: ndarray) -> Tuple[int, int, int, int, float, float, int, int]: ) +@spicelock_for_multithread @spice_error_check def spkuef(handle: int) -> None: """ @@ -12433,6 +12958,7 @@ def spkuef(handle: int) -> None: libspice.spkuef_c(handle) +@spicelock_for_multithread @spice_error_check def spkw02( handle: int, @@ -12494,6 +13020,7 @@ def spkw02( ) +@spicelock_for_multithread @spice_error_check def spkw03( handle: int, @@ -12555,6 +13082,7 @@ def spkw03( ) +@spicelock_for_multithread @spice_error_check def spkw05( handle: int, @@ -12605,6 +13133,7 @@ def spkw05( ) +@spicelock_for_multithread @spice_error_check def spkw08( handle: int, @@ -12667,6 +13196,7 @@ def spkw08( ) +@spicelock_for_multithread @spice_error_check def spkw09( handle: int, @@ -12714,6 +13244,7 @@ def spkw09( ) +@spicelock_for_multithread @spice_error_check def spkw10( handle: int, @@ -12762,6 +13293,7 @@ def spkw10( ) +@spicelock_for_multithread @spice_error_check def spkw12( handle: int, @@ -12823,6 +13355,7 @@ def spkw12( ) +@spicelock_for_multithread @spice_error_check def spkw13( handle: int, @@ -12870,6 +13403,7 @@ def spkw13( ) +@spicelock_for_multithread @spice_error_check def spkw15( handle: int, @@ -12951,6 +13485,7 @@ def spkw15( ) +@spicelock_for_multithread @spice_error_check def spkw17( handle: int, @@ -12998,6 +13533,7 @@ def spkw17( ) +@spicelock_for_multithread @spice_error_check def spkw18( handle: int, @@ -13057,6 +13593,7 @@ def spkw18( ) +@spicelock_for_multithread @spice_error_check def spkw20( handle: int, @@ -13130,6 +13667,7 @@ def spkw20( ) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def srfc2s(code: int, bodyid: int, srflen: int = _default_len_out) -> Tuple[str, bool]: @@ -13157,6 +13695,7 @@ def srfc2s(code: int, bodyid: int, srflen: int = _default_len_out) -> Tuple[str, return stypes.to_python_string(srfstr), bool(isname.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def srfcss(code: int, bodstr: str, srflen: int = _default_len_out) -> Tuple[str, bool]: @@ -13182,6 +13721,7 @@ def srfcss(code: int, bodstr: str, srflen: int = _default_len_out) -> Tuple[str, return stypes.to_python_string(srfstr), bool(isname.value) +@spicelock_for_multithread @spice_error_check def srfnrm( method: str, target: str, et: float, fixref: str, srfpts: ndarray @@ -13213,6 +13753,7 @@ def srfnrm( return stypes.c_matrix_to_numpy(normls) +@spicelock_for_multithread @spice_error_check def srfrec(body: int, longitude: float, latitude: float) -> ndarray: """ @@ -13234,6 +13775,7 @@ def srfrec(body: int, longitude: float, latitude: float) -> ndarray: return stypes.c_vector_to_python(rectan) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def srfs2c(srfstr: str, bodstr: str) -> Tuple[int, bool]: @@ -13256,6 +13798,7 @@ def srfs2c(srfstr: str, bodstr: str) -> Tuple[int, bool]: return code.value, bool(isname.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def srfscc(srfstr: str, bodyid: int) -> Tuple[int, bool]: @@ -13278,6 +13821,7 @@ def srfscc(srfstr: str, bodyid: int) -> Tuple[int, bool]: return code.value, bool(isname.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def srfxpt( @@ -13386,6 +13930,7 @@ def srfxpt( ) +@spicelock_for_multithread @spice_error_check def ssize(newsize: int, cell: SpiceCell) -> SpiceCell: """ @@ -13403,6 +13948,7 @@ def ssize(newsize: int, cell: SpiceCell) -> SpiceCell: return cell +@spicelock_for_multithread @spice_error_check def stelab(pobj: ndarray, vobs: ndarray) -> ndarray: """ @@ -13426,6 +13972,7 @@ def stelab(pobj: ndarray, vobs: ndarray) -> ndarray: return stypes.c_vector_to_python(appobj) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def stpool( @@ -13459,6 +14006,7 @@ def stpool( return stypes.to_python_string(strout), sizet.value, bool(found.value) +@spicelock_for_multithread @spice_error_check def str2et(time: Union[str, Iterable[str]]) -> Union[float, ndarray]: """ @@ -13485,6 +14033,7 @@ def str2et(time: Union[str, Iterable[str]]) -> Union[float, ndarray]: return et.value +@spicelock_for_multithread @spice_error_check def datetime2et(dt: Union[Iterable[datetime], datetime]) -> Union[ndarray, float]: """ @@ -13532,6 +14081,7 @@ def fromisoformat(s): return datetime.strptime(s, "%Y-%m-%dT%H:%M:%S.%f").replace(tzinfo=timezone.utc) +@spicelock_for_multithread @spice_error_check def et2datetime(et: Union[Iterable[float], float]) -> Union[ndarray, datetime]: """ @@ -13550,6 +14100,7 @@ def et2datetime(et: Union[Iterable[float], float]) -> Union[ndarray, datetime]: return fromisoformat(result) +@spicelock_for_multithread @spice_error_check def subpnt( method: str, target: str, et: float, fixref: str, abcorr: str, obsrvr: str @@ -13593,6 +14144,7 @@ def subpnt( ) +@spicelock_for_multithread @spice_error_check def subpt( method: str, @@ -13653,6 +14205,7 @@ def subpt( return stypes.c_vector_to_python(spoint), alt.value +@spicelock_for_multithread @spice_error_check def subslr( method: str, target: str, et: float, fixref: str, abcorr: str, obsrvr: str @@ -13696,6 +14249,7 @@ def subslr( ) +@spicelock_for_multithread @spice_error_check def subsol(method: str, target: str, et: float, abcorr: str, obsrvr: str) -> ndarray: """ @@ -13727,6 +14281,7 @@ def subsol(method: str, target: str, et: float, abcorr: str, obsrvr: str) -> nda return stypes.c_vector_to_python(spoint) +@spicelock_for_multithread @spice_error_check def sumad(array: Sequence[float]) -> float: """ @@ -13742,6 +14297,7 @@ def sumad(array: Sequence[float]) -> float: return libspice.sumad_c(array, n) +@spicelock_for_multithread @spice_error_check def sumai(array: Sequence[int]) -> int: """ @@ -13757,6 +14313,7 @@ def sumai(array: Sequence[int]) -> int: return libspice.sumai_c(array, n) +@spicelock_for_multithread @spice_error_check def surfnm( a: float, b: float, c: float, point: Union[ndarray, Iterable[float]] @@ -13782,6 +14339,7 @@ def surfnm( return stypes.c_vector_to_python(normal) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def surfpt( @@ -13815,6 +14373,7 @@ def surfpt( return stypes.c_vector_to_python(point), bool(found.value) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def surfpv( @@ -13848,6 +14407,7 @@ def surfpv( return stypes.c_vector_to_python(stx), bool(found.value) +@spicelock_for_multithread @spice_error_check def swpool(agent: str, nnames: int, lenvals: int, names: Iterable[str]) -> None: """ @@ -13868,6 +14428,7 @@ def swpool(agent: str, nnames: int, lenvals: int, names: Iterable[str]) -> None: libspice.swpool_c(agent, nnames, lenvals, names) +@spicelock_for_multithread @spice_error_check def sxform(instring: str, tostring: str, et: Union[float, ndarray]) -> ndarray: """ @@ -13898,6 +14459,7 @@ def sxform(instring: str, tostring: str, et: Union[float, ndarray]) -> ndarray: return stypes.c_matrix_to_numpy(xform) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def szpool(name: str) -> Tuple[int, bool]: @@ -13920,6 +14482,7 @@ def szpool(name: str) -> Tuple[int, bool]: # T +@spicelock_for_multithread @spice_error_check def termpt( method: str, @@ -14019,6 +14582,7 @@ def termpt( ) +@spicelock_for_multithread @spice_error_check def timdef(action: str, item: str, lenout: int, value: Optional[str] = None) -> str: """ @@ -14043,6 +14607,7 @@ def timdef(action: str, item: str, lenout: int, value: Optional[str] = None) -> return stypes.to_python_string(value) +@spicelock_for_multithread @spice_error_check def timout( et: Union[ndarray, float], pictur: str, lenout: int = _default_len_out @@ -14075,6 +14640,7 @@ def timout( return stypes.to_python_string(output) +@spicelock_for_multithread @spice_error_check def tipbod(ref: str, body: int, et: float) -> ndarray: """ @@ -14097,6 +14663,7 @@ def tipbod(ref: str, body: int, et: float) -> ndarray: return stypes.c_matrix_to_numpy(retmatrix) +@spicelock_for_multithread @spice_error_check def tisbod(ref: str, body: int, et: float) -> ndarray: """ @@ -14118,6 +14685,7 @@ def tisbod(ref: str, body: int, et: float) -> ndarray: return stypes.c_matrix_to_numpy(retmatrix) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def tkfram(typid: int) -> Tuple[ndarray, int, bool]: @@ -14140,7 +14708,8 @@ def tkfram(typid: int) -> Tuple[ndarray, int, bool]: return stypes.c_matrix_to_numpy(matrix), next_frame.value, bool(found.value) -# @spice_error_check +@spicelock_for_multithread +@spice_error_check def tkvrsn(item: str) -> str: """ Given an item such as the Toolkit or an entry point name, return @@ -14155,6 +14724,7 @@ def tkvrsn(item: str) -> str: return stypes.to_python_string(libspice.tkvrsn_c(item)) +@spicelock_for_multithread @spice_error_check def tparse(instring: str, lenout: int = _default_len_out) -> Tuple[float, str]: """ @@ -14175,6 +14745,7 @@ def tparse(instring: str, lenout: int = _default_len_out) -> Tuple[float, str]: return sp2000.value, stypes.to_python_string(errmsg) +@spicelock_for_multithread @spice_error_check def tpictr( sample: str, lenout: int = _default_len_out, lenerr: int = _default_len_out @@ -14203,6 +14774,7 @@ def tpictr( return stypes.to_python_string(pictur), ok.value, stypes.to_python_string(errmsg) +@spicelock_for_multithread @spice_error_check def trace(matrix: Union[ndarray, Iterable[Iterable[float]]]) -> float: """ @@ -14217,6 +14789,7 @@ def trace(matrix: Union[ndarray, Iterable[Iterable[float]]]) -> float: return libspice.trace_c(matrix) +@spicelock_for_multithread @spice_error_check def trcdep() -> int: """ @@ -14231,6 +14804,7 @@ def trcdep() -> int: return depth.value +@spicelock_for_multithread @spice_error_check def trcnam(index: int, namlen: int = _default_len_out) -> str: """ @@ -14251,6 +14825,7 @@ def trcnam(index: int, namlen: int = _default_len_out) -> str: return stypes.to_python_string(name) +@spicelock_for_multithread @spice_error_check def trcoff() -> None: """ @@ -14262,6 +14837,7 @@ def trcoff() -> None: libspice.trcoff_c() +@spicelock_for_multithread @spice_error_check def tsetyr(year: int) -> None: """ @@ -14277,6 +14853,7 @@ def tsetyr(year: int) -> None: libspice.tsetyr_c(year) +@spicelock_for_multithread @spice_error_check def twopi() -> float: """ @@ -14290,6 +14867,7 @@ def twopi() -> float: return libspice.twopi_c() +@spicelock_for_multithread @spice_error_check def twovec( axdef: Union[ndarray, Iterable[float]], @@ -14319,6 +14897,7 @@ def twovec( return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def txtopn(fname: str) -> int: """ @@ -14338,6 +14917,7 @@ def txtopn(fname: str) -> int: return unit_out.value +@spicelock_for_multithread @spice_error_check def tyear() -> float: """ @@ -14354,6 +14934,7 @@ def tyear() -> float: # U +@spicelock_for_multithread @spice_error_check def ucase(inchar: str, lenout: Optional[int] = None) -> str: """ @@ -14374,6 +14955,7 @@ def ucase(inchar: str, lenout: Optional[int] = None) -> str: return stypes.to_python_string(outchar) +@spicelock_for_multithread @spice_error_check def ucrss(v1: ndarray, v2: ndarray) -> ndarray: """ @@ -14427,6 +15009,7 @@ def udfunc(et_in): return bool(isdescr.value) +@spicelock_for_multithread @spice_error_check def uddf(udfunc: UDFUNC, x: float, dx: float) -> float: """ @@ -14474,6 +15057,7 @@ def udf(x: float) -> float: return value.value +@spicelock_for_multithread @spice_error_check def union(a: SpiceCell, b: SpiceCell) -> SpiceCell: """ @@ -14502,6 +15086,7 @@ def union(a: SpiceCell, b: SpiceCell) -> SpiceCell: return c +@spicelock_for_multithread @spice_error_check def unitim(epoch: float, insys: str, outsys: str) -> float: """ @@ -14523,6 +15108,7 @@ def unitim(epoch: float, insys: str, outsys: str) -> float: return libspice.unitim_c(epoch, insys, outsys) +@spicelock_for_multithread @spice_error_check def unload(filename: Union[str, Iterable[str]]) -> None: """ @@ -14540,6 +15126,7 @@ def unload(filename: Union[str, Iterable[str]]) -> None: libspice.unload_c(filename) +@spicelock_for_multithread @spice_error_check def unorm(v1: ndarray) -> Tuple[ndarray, float]: """ @@ -14557,6 +15144,7 @@ def unorm(v1: ndarray) -> Tuple[ndarray, float]: return stypes.c_vector_to_python(vout), vmag.value +@spicelock_for_multithread @spice_error_check def unormg(v1: ndarray, ndim: int) -> Tuple[ndarray, float]: """ @@ -14577,6 +15165,7 @@ def unormg(v1: ndarray, ndim: int) -> Tuple[ndarray, float]: return stypes.c_vector_to_python(vout), vmag.value +@spicelock_for_multithread @spice_error_check def utc2et(utcstr: str) -> float: """ @@ -14598,6 +15187,7 @@ def utc2et(utcstr: str) -> float: # V +@spicelock_for_multithread @spice_error_check def vadd( v1: Union[ndarray, Iterable[float]], v2: Union[ndarray, Iterable[float]] @@ -14616,6 +15206,7 @@ def vadd( return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vaddg( v1: Union[ndarray, Iterable[float]], v2: Union[ndarray, Iterable[float]], ndim: int @@ -14637,6 +15228,7 @@ def vaddg( return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def valid(insize: int, n: int, inset: SpiceCell) -> SpiceCell: """ @@ -14656,6 +15248,7 @@ def valid(insize: int, n: int, inset: SpiceCell) -> SpiceCell: return inset +@spicelock_for_multithread @spice_error_check def vcrss(v1: ndarray, v2: ndarray) -> ndarray: """ @@ -14674,6 +15267,7 @@ def vcrss(v1: ndarray, v2: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vdist(v1: ndarray, v2: ndarray) -> float: """ @@ -14690,6 +15284,7 @@ def vdist(v1: ndarray, v2: ndarray) -> float: return libspice.vdist_c(v1, v2) +@spicelock_for_multithread @spice_error_check def vdistg(v1: ndarray, v2: ndarray, ndim: int) -> float: """ @@ -14708,6 +15303,7 @@ def vdistg(v1: ndarray, v2: ndarray, ndim: int) -> float: return libspice.vdistg_c(v1, v2, ndim) +@spicelock_for_multithread @spice_error_check def vdot(v1: ndarray, v2: ndarray) -> float: """ @@ -14724,6 +15320,7 @@ def vdot(v1: ndarray, v2: ndarray) -> float: return libspice.vdot_c(v1, v2) +@spicelock_for_multithread @spice_error_check def vdotg(v1: ndarray, v2: ndarray, ndim: int) -> float: """ @@ -14743,6 +15340,7 @@ def vdotg(v1: ndarray, v2: ndarray, ndim: int) -> float: return libspice.vdotg_c(v1, v2, ndim) +@spicelock_for_multithread @spice_error_check def vequ(v1: ndarray) -> ndarray: """ @@ -14759,6 +15357,7 @@ def vequ(v1: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vequg(v1: ndarray, ndim: int) -> ndarray: """ @@ -14777,6 +15376,7 @@ def vequg(v1: ndarray, ndim: int) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vhat(v1: ndarray) -> ndarray: """ @@ -14793,6 +15393,7 @@ def vhat(v1: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vhatg(v1: ndarray, ndim: int) -> ndarray: """ @@ -14811,6 +15412,7 @@ def vhatg(v1: ndarray, ndim: int) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vlcom( a: float, @@ -14839,6 +15441,7 @@ def vlcom( return stypes.c_vector_to_python(sumv) +@spicelock_for_multithread @spice_error_check def vlcom3( a: float, @@ -14873,6 +15476,7 @@ def vlcom3( return stypes.c_vector_to_python(sumv) +@spicelock_for_multithread @spice_error_check def vlcomg( n: int, @@ -14904,6 +15508,7 @@ def vlcomg( return stypes.c_vector_to_python(sumv) +@spicelock_for_multithread @spice_error_check def vminug(vin: ndarray, ndim: int) -> ndarray: """ @@ -14922,6 +15527,7 @@ def vminug(vin: ndarray, ndim: int) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vminus(vin: ndarray) -> ndarray: """ @@ -14938,6 +15544,7 @@ def vminus(vin: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vnorm(v: ndarray) -> float: """ @@ -14952,6 +15559,7 @@ def vnorm(v: ndarray) -> float: return libspice.vnorm_c(v) +@spicelock_for_multithread @spice_error_check def vnormg(v: ndarray, ndim: int) -> float: """ @@ -14968,6 +15576,7 @@ def vnormg(v: ndarray, ndim: int) -> float: return libspice.vnormg_c(v, ndim) +@spicelock_for_multithread @spice_error_check def vpack(x: float, y: float, z: float) -> ndarray: """ @@ -14988,6 +15597,7 @@ def vpack(x: float, y: float, z: float) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vperp(a: ndarray, b: ndarray) -> ndarray: """ @@ -15007,6 +15617,7 @@ def vperp(a: ndarray, b: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vprjp(vin: Union[ndarray, Iterable[float]], plane: Plane) -> ndarray: """ @@ -15024,6 +15635,7 @@ def vprjp(vin: Union[ndarray, Iterable[float]], plane: Plane) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check @spice_found_exception_thrower def vprjpi( @@ -15049,6 +15661,7 @@ def vprjpi( return stypes.c_vector_to_python(vout), bool(found.value) +@spicelock_for_multithread @spice_error_check def vproj(a: ndarray, b: ndarray) -> ndarray: """ @@ -15067,6 +15680,7 @@ def vproj(a: ndarray, b: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vrel( v1: Union[ndarray, Iterable[float]], v2: Union[ndarray, Iterable[float]] @@ -15085,6 +15699,7 @@ def vrel( return libspice.vrel_c(v1, v2) +@spicelock_for_multithread @spice_error_check def vrelg( v1: Union[ndarray, Iterable[float]], v2: Union[ndarray, Iterable[float]], ndim: int @@ -15105,6 +15720,7 @@ def vrelg( return libspice.vrelg_c(v1, v2, ndim) +@spicelock_for_multithread @spice_error_check def vrotv(v: ndarray, axis: ndarray, theta: float) -> ndarray: """ @@ -15126,6 +15742,7 @@ def vrotv(v: ndarray, axis: ndarray, theta: float) -> ndarray: return stypes.c_vector_to_python(r) +@spicelock_for_multithread @spice_error_check def vscl(s: float, v1: ndarray) -> ndarray: """ @@ -15144,6 +15761,7 @@ def vscl(s: float, v1: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vsclg(s: float, v1: ndarray, ndim: int) -> ndarray: """ @@ -15164,6 +15782,7 @@ def vsclg(s: float, v1: ndarray, ndim: int) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vsep(v1: ndarray, v2: ndarray) -> float: """ @@ -15182,6 +15801,7 @@ def vsep(v1: ndarray, v2: ndarray) -> float: return libspice.vsep_c(v1, v2) +@spicelock_for_multithread @spice_error_check def vsepg(v1: ndarray, v2: ndarray, ndim: int) -> float: """ @@ -15202,6 +15822,7 @@ def vsepg(v1: ndarray, v2: ndarray, ndim: int) -> float: return libspice.vsepg_c(v1, v2, ndim) +@spicelock_for_multithread @spice_error_check def vsub(v1: ndarray, v2: ndarray) -> ndarray: """ @@ -15221,6 +15842,7 @@ def vsub(v1: ndarray, v2: ndarray) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vsubg(v1: ndarray, v2: ndarray, ndim: int) -> ndarray: """ @@ -15242,6 +15864,7 @@ def vsubg(v1: ndarray, v2: ndarray, ndim: int) -> ndarray: return stypes.c_vector_to_python(vout) +@spicelock_for_multithread @spice_error_check def vtmv(v1: ndarray, matrix: ndarray, v2: ndarray) -> float: """ @@ -15261,6 +15884,7 @@ def vtmv(v1: ndarray, matrix: ndarray, v2: ndarray) -> float: return libspice.vtmv_c(v1, matrix, v2) +@spicelock_for_multithread @spice_error_check def vtmvg( v1: ndarray, @@ -15293,6 +15917,7 @@ def vtmvg( return libspice.vtmvg_c(v1, matrix, v2, nrow, ncol) +@spicelock_for_multithread @spice_error_check def vupack(v: ndarray) -> Tuple[float, float, float]: """ @@ -15311,6 +15936,7 @@ def vupack(v: ndarray) -> Tuple[float, float, float]: return x.value, y.value, z.value +@spicelock_for_multithread @spice_error_check def vzero(v: ndarray) -> bool: """ @@ -15325,6 +15951,7 @@ def vzero(v: ndarray) -> bool: return bool(libspice.vzero_c(v)) +@spicelock_for_multithread @spice_error_check def vzerog(v: ndarray, ndim: int) -> bool: """ @@ -15345,6 +15972,7 @@ def vzerog(v: ndarray, ndim: int) -> bool: # W +@spicelock_for_multithread @spice_error_check def wncard(window: SpiceCell) -> int: """ @@ -15360,6 +15988,7 @@ def wncard(window: SpiceCell) -> int: return libspice.wncard_c(window) +@spicelock_for_multithread @spice_error_check def wncomd(left: float, right: float, window: SpiceCell) -> SpiceCell: """ @@ -15382,6 +16011,7 @@ def wncomd(left: float, right: float, window: SpiceCell) -> SpiceCell: return result +@spicelock_for_multithread @spice_error_check def wncond(left: float, right: float, window: SpiceCell) -> SpiceCell: """ @@ -15402,6 +16032,7 @@ def wncond(left: float, right: float, window: SpiceCell) -> SpiceCell: return window +@spicelock_for_multithread @spice_error_check def wndifd(a: SpiceCell, b: SpiceCell) -> SpiceCell: """ @@ -15423,6 +16054,7 @@ def wndifd(a: SpiceCell, b: SpiceCell) -> SpiceCell: return c +@spicelock_for_multithread @spice_error_check def wnelmd(point: float, window: SpiceCell) -> bool: """ @@ -15441,6 +16073,7 @@ def wnelmd(point: float, window: SpiceCell) -> bool: return bool(libspice.wnelmd_c(point, ctypes.byref(window))) +@spicelock_for_multithread @spice_error_check def wnexpd(left: float, right: float, window: SpiceCell) -> SpiceCell: """ @@ -15461,6 +16094,7 @@ def wnexpd(left: float, right: float, window: SpiceCell) -> SpiceCell: return window +@spicelock_for_multithread @spice_error_check def wnextd(side: str, window: SpiceCell) -> SpiceCell: """ @@ -15481,6 +16115,7 @@ def wnextd(side: str, window: SpiceCell) -> SpiceCell: return window +@spicelock_for_multithread @spice_error_check def wnfetd(window: SpiceCell, n: int) -> Tuple[float, float]: """ @@ -15501,6 +16136,7 @@ def wnfetd(window: SpiceCell, n: int) -> Tuple[float, float]: return left.value, right.value +@spicelock_for_multithread @spice_error_check def wnfild(small: float, window: SpiceCell) -> SpiceCell: """ @@ -15519,6 +16155,7 @@ def wnfild(small: float, window: SpiceCell) -> SpiceCell: return window +@spicelock_for_multithread @spice_error_check def wnfltd(small: float, window: SpiceCell) -> SpiceCell: """ @@ -15537,6 +16174,7 @@ def wnfltd(small: float, window: SpiceCell) -> SpiceCell: return window +@spicelock_for_multithread @spice_error_check def wnincd(left: float, right: float, window: SpiceCell) -> bool: """ @@ -15556,6 +16194,7 @@ def wnincd(left: float, right: float, window: SpiceCell) -> bool: return bool(libspice.wnincd_c(left, right, ctypes.byref(window))) +@spicelock_for_multithread @spice_error_check def wninsd(left: float, right: float, window: SpiceCell) -> None: """ @@ -15574,6 +16213,7 @@ def wninsd(left: float, right: float, window: SpiceCell) -> None: libspice.wninsd_c(left, right, ctypes.byref(window)) +@spicelock_for_multithread @spice_error_check def wnintd(a: SpiceCell, b: SpiceCell) -> SpiceCell: """ @@ -15596,6 +16236,7 @@ def wnintd(a: SpiceCell, b: SpiceCell) -> SpiceCell: return c +@spicelock_for_multithread @spice_error_check def wnreld(a: SpiceCell, op: str, b: SpiceCell) -> bool: """ @@ -15617,6 +16258,7 @@ def wnreld(a: SpiceCell, op: str, b: SpiceCell) -> bool: return bool(libspice.wnreld_c(ctypes.byref(a), op, ctypes.byref(b))) +@spicelock_for_multithread @spice_error_check def wnsumd(window: SpiceCell) -> Tuple[float, float, float, int, int]: """ @@ -15649,6 +16291,7 @@ def wnsumd(window: SpiceCell) -> Tuple[float, float, float, int, int]: return meas.value, avg.value, stddev.value, shortest.value, longest.value +@spicelock_for_multithread @spice_error_check def wnunid(a: SpiceCell, b: SpiceCell) -> SpiceCell: """ @@ -15669,6 +16312,7 @@ def wnunid(a: SpiceCell, b: SpiceCell) -> SpiceCell: return c +@spicelock_for_multithread @spice_error_check def wnvald(insize: int, n: int, window: SpiceCell) -> SpiceCell: """ @@ -15690,6 +16334,7 @@ def wnvald(insize: int, n: int, window: SpiceCell) -> SpiceCell: return window +@spicelock_for_multithread @spice_error_check def writln(line: str, unit: int) -> None: """ @@ -15727,6 +16372,7 @@ def writln(line: str, unit: int) -> None: # X +@spicelock_for_multithread @spice_error_check def xf2eul(xform: ndarray, axisa: int, axisb: int, axisc: int) -> Tuple[ndarray, int]: """ @@ -15755,6 +16401,7 @@ def xf2eul(xform: ndarray, axisa: int, axisb: int, axisc: int) -> Tuple[ndarray, return stypes.c_vector_to_python(eulang), unique.value +@spicelock_for_multithread @spice_error_check def xf2rav(xform: ndarray) -> Tuple[ndarray, ndarray]: """ @@ -15775,6 +16422,7 @@ def xf2rav(xform: ndarray) -> Tuple[ndarray, ndarray]: return stypes.c_matrix_to_numpy(rot), stypes.c_vector_to_python(av) +@spicelock_for_multithread @spice_error_check def xfmsta( input_state: ndarray, input_coord_sys: str, output_coord_sys: str, body: str @@ -15803,6 +16451,7 @@ def xfmsta( return stypes.c_vector_to_python(output_state) +@spicelock_for_multithread @spice_error_check def xpose(m: Union[ndarray, Iterable[Iterable[float]]]) -> ndarray: """ @@ -15819,6 +16468,7 @@ def xpose(m: Union[ndarray, Iterable[Iterable[float]]]) -> ndarray: return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def xpose6(m: Union[ndarray, Iterable[Iterable[float]]]) -> ndarray: """ @@ -15835,6 +16485,7 @@ def xpose6(m: Union[ndarray, Iterable[Iterable[float]]]) -> ndarray: return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def xposeg( matrix: Union[ndarray, Iterable[Iterable[float]]], @@ -15862,6 +16513,7 @@ def xposeg( return stypes.c_matrix_to_numpy(mout) +@spicelock_for_multithread @spice_error_check def zzdynrot(typid: int, center: int, et: float) -> Tuple[ndarray, int]: """ diff --git a/spiceypy/tests/test_wrapper.py b/spiceypy/tests/test_wrapper.py index 173e56b5..f2d2a85a 100644 --- a/spiceypy/tests/test_wrapper.py +++ b/spiceypy/tests/test_wrapper.py @@ -42,11 +42,50 @@ cwd, ) - def setup_module(module): download_kernels() +def test_threading_lock(): + nOperations = 1000 + spice.kclear() + spice.furnsh(CoreKernels.testMetaKernel) + et = spice.str2et("Dec 25, 2007") + from multiprocessing.pool import ThreadPool + ets = np.array([et]*nOperations) + state, ltime = spice.spkezr("Moon", et, "J2000", "NONE", "EARTH") + state = np.array([state]*nOperations) + with ThreadPool(processes = 2) as pool: + with spice.threading_lock(): + states = pool.map(lambda x: spice.spkezr("Moon", x, "J2000", "NONE", "EARTH")[0],ets) + states = np.array(states) + spice.kclear() + npt.assert_array_almost_equal(states, state, decimal=5) + +def test_no_threading_lock(): + nOperations = 10 + spice.kclear() + spice.furnsh(CoreKernels.testMetaKernel) + et = spice.str2et("Dec 25, 2007") + ets = np.array([et]*nOperations) + state, ltime = spice.spkezr("Moon", et, "J2000", "NONE", "EARTH") + state = np.array([state]*nOperations) + with spice.no_threading_lock(): + states = [] + for et in ets: + states.append(spice.spkezr("Moon", ets, "J2000", "NONE", "EARTH")[0]) + states = np.array(states) + spice.kclear() + npt.assert_array_almost_equal(states, state, decimal=5) + +def test_change_threading_lock(): + spice.threading_lock_off() + stateOff = spice.get_threading_lock_state() + spice.threading_lock_on() + stateOn = spice.get_threading_lock_state() + assert stateOff == False + assert stateOn == True + def test_appndc(): test_cell = spice.cell_char(10, 10) spice.appndc("one", test_cell)