def test_bodX2Y(self): self.assertEqual( spice.bodc2n( 99, ), 'MYBOD' ) self.assertEqual( spice.bodn2c( 'MYBOD', ), 99 ) self.assertEqual( spice.bodc2s( -99, ), '-99' ) self.assertEqual( spice.bods2c( '-99', ), -99 ) self.assertEqual( spice.bods2c( '99', ), 99 ) self.assertEqual( spice.bods2c( 'MYBOD', ), 99 ) self.assertEqual( spice.bodc2n( 999, ), 'PLUTO' ) self.assertEqual( spice.bodn2c( 'PLUTO', ), 999 ) self.assertEqual( spice.bods2c( '999', ), 999 ) self.assertEqual( spice.bods2c( 'PLUTO', ), 999 )
def __init__(self, obj, kernel=None): import spice if not core._spice_setup: core._setup_spice() if kernel is None: kernel = core.find_kernel(obj) core.load_kernel(kernel) self.kernel = kernel if isinstance(obj, int): obj = str(obj) naifid = spice.bods2c(obj) if naifid is None: raise ObjectError(("NAIF ID of {} cannot be found" " in kernel {}.").format(obj, kernel)) self.obj = obj self.naifid = naifid