Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewAnnex committed Apr 15, 2018
1 parent 05da1e8 commit 87bb65d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 24 deletions.
37 changes: 18 additions & 19 deletions spiceypy/spiceypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -5669,29 +5669,27 @@ def gffove(inst, tshape, raydir, target, tframe, abcorr, obsrvr,
:type obsrvr: str
:param tol: Convergence tolerance in seconds
:type tol: float
:param udstep: Name of the routine returns a time step
:type udstep:
:param udstep: Name of the routine that returns a time step
:type udstep: spiceypy.utils.callbacks.UDSTEP
:param udrefn: Name of the routine that computes a refined time
:type udrefn: float
:type udrefn: spiceypy.utils.callbacks.UDREFN
:param rpt: Progress report flag
:type rpt: bool
:param udrepi: Function that initializes progress reporting
:type udrepi:
:param udrepi: Function that initializes progress reporting.
:type udrepi: spiceypy.utils.callbacks.UDREP
:param udrepu: Function that updates the progress report
:type udrepu: float
:type udrepu: spiceypy.utils.callbacks.UDREPU
:param udrepf: Function that finalizes progress reporting
:type udrepf: bool
:type udrepf: spiceypy.utils.callbacks.UDREPF
:param bail: Logical indicating program interrupt monitoring
:type bail: bool
:param udbail: Name of a routine that signals a program interrupt
:type udbail: float
:type udbail: spiceypy.utils.callbacks.UDBAIL
:param cnfine: SPICE window to which the search is restricted
:type cnfine: spiceypy.utils.support_types.SpiceCell
:param result: SPICE window containing results
:type result: spiceypy.utils.support_types.SpiceCell
"""
assert isinstance(cnfine, stypes.SpiceCell)
assert isinstance(result, stypes.SpiceCell)
inst = stypes.stringToCharP(inst)
tshape = stypes.stringToCharP(tshape)
raydir = stypes.toDoubleVector(raydir)
Expand Down Expand Up @@ -5784,6 +5782,7 @@ def gfinth(sigcode):
sigcode = ctypes.c_int(sigcode)
libspice.gfinth_c(sigcode)


@spiceErrorCheck
def gfocce(occtyp, front, fshape, fframe, back,
bshape, bframe, abcorr, obsrvr, tol,
Expand Down Expand Up @@ -5819,27 +5818,27 @@ def gfocce(occtyp, front, fshape, fframe, back,
:type obsrvr: str
:param tol: Convergence tolerance in seconds
:type tol: float
:param udstep: Name of the routine that returns a time step
:type udstep: spiceypy.utils.callbacks.UDSTEP
:param udrefn: Name of the routine that computes a refined time
:type udrefn:
:type udrefn: spiceypy.utils.callbacks.UDREFN
:param rpt: Progress report flag
:type rpt: float
:type rpt: bool
:param udrepi: Function that initializes progress reporting.
:type udrepi: spiceypy.utils.callbacks.UDREP
:param udrepu: Function that updates the progress report
:type udrepu:
:type udrepu: spiceypy.utils.callbacks.UDREPU
:param udrepf: Function that finalizes progress reporting
:type udrepf: float
:type udrepf: spiceypy.utils.callbacks.UDREPF
:param bail: Logical indicating program interrupt monitoring
:type bail: bool
:param udbail: Name of a routine that signals a program interrupt
:type udbail: bool
:type udbail: spiceypy.utils.callbacks.UDBAIL
:param cnfine: SPICE window to which the search is restricted
:type cnfine: spiceypy.utils.support_types.SpiceCell
:param result: SPICE window containing results.
:type result: spiceypy.utils.support_types.SpiceCell
"""
assert isinstance(cnfine, stypes.SpiceCell)
assert cnfine.is_double()
assert isinstance(result, stypes.SpiceCell)
assert result.is_double()
occtyp = stypes.stringToCharP(occtyp)
front = stypes.stringToCharP(front)
fshape = stypes.stringToCharP(fshape)
Expand Down
4 changes: 1 addition & 3 deletions spiceypy/tests/test_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3129,13 +3129,11 @@ def test_gffove():
spice.furnsh(CassiniKernels.cassSclk)
spice.furnsh(CassiniKernels.cassTourSpk)
spice.furnsh(CassiniKernels.satSpk)
# Changed ABCORR to NONE from S for this test, so we do not need SSB
# begin test
# Cassini ISS NAC observed Enceladus on 2013-FEB-25 from ~11:00 to ~12:00
# Split confinement window, from continuous CK coverage, into two pieces
et_start = spice.str2et("2013-FEB-25 10:00:00.000")
et_end = spice.str2et("2013-FEB-25 11:45:00.000")
cnfine = spice.stypes.SPICEDOUBLE_CELL(2)
cnfine = spice.stypes.SPICEDOUBLE_CELL(2)
spice.wninsd(et_start, et_end, cnfine)
result = spice.stypes.SPICEDOUBLE_CELL(1000)
# call gffove
Expand Down
47 changes: 45 additions & 2 deletions spiceypy/utils/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ def wrapping_udfuns(x, value):
def SpiceUDFUNB(f):
"""
Decorator for wrapping python functions in spice udfunb callback type
:param f:
:param f: function to be wrapped
:type f: builtins.function
:return:
:return: wrapped udfunb function
:rtype: builtins.function
"""

@functools.wraps(f)
Expand All @@ -67,6 +68,13 @@ def wrapping_udfunb(udf, et, xbool):
return UDFUNB(wrapping_udfunb)

def SpiceUDSTEP(f):
"""
Decorator for wrapping python functions in spice udstep callback type
:param f: function to be wrapped
:type f: builtins.function
:return: wrapped udstep function
:rtype: builtins.function
"""

@functools.wraps(f)
def wrapping_udstep(x, value):
Expand All @@ -76,6 +84,13 @@ def wrapping_udstep(x, value):
return UDSTEP(wrapping_udstep)

def SpiceUDREFN(f):
"""
Decorator for wrapping python functions in spice udrefn callback type
:param f: function to be wrapped
:type f: builtins.function
:return: wrapped udrefn function
:rtype: builtins.function
"""
@functools.wraps(f)
def wrapping_udrefn(t1, t2, s1, s2, t):
result = f(t1, t2, s1, s2)
Expand All @@ -84,27 +99,55 @@ def wrapping_udrefn(t1, t2, s1, s2, t):
return UDREFN(wrapping_udrefn)

def SpiceUDREPI(f):
"""
Decorator for wrapping python functions in spice udfrepi callback type
:param f: function to be wrapped
:type f: builtins.function
:return: wrapped udrepi function
:rtype: builtins.function
"""
@functools.wraps(f)
def wrapping_udrepi(cnfine, srcpre, srcsurf):
f(cnfine, srcpre, srcsurf)

return UDREPI(wrapping_udrepi)

def SpiceUDREPU(f):
"""
Decorator for wrapping python functions in spice udrepu callback type
:param f: function to be wrapped
:type f: builtins.function
:return: wrapped udrepu function
:rtype: builtins.function
"""
@functools.wraps(f)
def wrapping_udrepu(beg, end, et):
f(beg, end, et)

return UDREPU(wrapping_udrepu)

def SpiceUDREPF(f):
"""
Decorator for wrapping python functions in spice udrepf callback type
:param f: function to be wrapped
:type f: builtins.function
:return: wrapped udrepf function
:rtype: builtins.function
"""
@functools.wraps(f)
def wrapping_udrepf():
f()
return UDREPF(wrapping_udrepf)


def SpiceUDBAIL(f):
"""
Decorator for wrapping python functions in spice udbail callback type
:param f: function to be wrapped
:type f: builtins.function
:return: wrapped udbail function
:rtype: builtins.function
"""
@functools.wraps(f)
def wrapping_udbail():
result = f()
Expand Down

0 comments on commit 87bb65d

Please sign in to comment.