当前位置: 首页>>代码示例>>Python>>正文


Python DateTime.nsecs方法代码示例

本文整理汇总了Python中lsst.daf.base.DateTime.nsecs方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.nsecs方法的具体用法?Python DateTime.nsecs怎么用?Python DateTime.nsecs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lsst.daf.base.DateTime的用法示例。


在下文中一共展示了DateTime.nsecs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testNsecsDefault

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testNsecsDefault(self):
     ts = DateTime(1192755506000000000)
     self.assertEqual(ts.nsecs(DateTime.UTC), 1192755473000000000)
     self.assertEqual(ts.nsecs(DateTime.TAI), 1192755506000000000)
     self.assertEqual(ts.nsecs(), 1192755506000000000)
     self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.UTC), 54392.040196759262)
     self.assertTrue(ts.isValid())
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:9,代码来源:test_dateTime.py

示例2: testIsoUTCBasic

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testIsoUTCBasic(self):
     """Test basic ISO string input and output of UTC dates"""
     for dateSep in ("-", ""):  # "-" date separator is optional
         for timeSep in (":", ""):  # ":" time separator is optional
             for decPt in (".", ","):  # "." or "," may be used as decimal point
                 dateStr = "2009{0}04{0}02T07{1}26{1}39{2}314159265Z".format(dateSep, timeSep, decPt)
                 ts = DateTime(dateStr, DateTime.UTC)
                 self.assertEqual(ts.nsecs(DateTime.TT), 1238657265498159265)
                 self.assertEqual(ts.nsecs(DateTime.TAI), 1238657233314159265)
                 self.assertEqual(ts.nsecs(DateTime.UTC), 1238657199314159265)
                 self.assertEqual(ts.toString(ts.UTC), "2009-04-02T07:26:39.314159265Z")
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:13,代码来源:test_dateTime.py

示例3: testLeapSecond

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testLeapSecond(self):
     trials = ((45205., 21),
               (41498.99, 10),
               (41499.01, 11),
               (57203.99, 35),
               (57204.01, 36),
               (57000., 35),
               (57210., 36))
     for mjd, diff in trials:
         ts = DateTime(mjd, DateTime.MJD, DateTime.UTC)
         delta = ts.nsecs(DateTime.TAI) - ts.nsecs(DateTime.UTC)
         self.assertEqual(delta/1E9, diff)
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:14,代码来源:test_dateTime.py

示例4: testNsecs

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testNsecs(self):
     ts = DateTime(1192755473000000000, DateTime.UTC)
     self.assertEqual(ts.nsecs(DateTime.UTC), 1192755473000000000)
     self.assertEqual(ts.nsecs(DateTime.TAI), 1192755506000000000)
     self.assertEqual(ts.nsecs(), 1192755506000000000)
     self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.UTC), 54392.040196759262)
     ts2 = ts
     self.assertEqual(ts, ts2)
     ts2 = DateTime(1192755473000000000, DateTime.UTC)
     self.assertEqual(ts, ts2)
     ts2 = DateTime(1234567890000000000, DateTime.UTC)
     self.assertNotEqual(ts, ts2)
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:14,代码来源:test_dateTime.py

示例5: testMJD

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testMJD(self):
     ts = DateTime(45205.125, DateTime.MJD, DateTime.UTC)
     self.assertEqual(ts.nsecs(DateTime.UTC), 399006000000000000)
     self.assertEqual(ts.nsecs(DateTime.TAI), 399006021000000000)
     self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.UTC), 45205.125)
     self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.TAI), 45205.125 + 21.0/86400.0)
     self.assertTrue(ts.isValid())
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:9,代码来源:test_dateTime.py

示例6: testMJD

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testMJD(self):
     ts = DateTime(45205.125, DateTime.MJD, DateTime.UTC)
     self.assertEqual(ts.nsecs(DateTime.UTC), 399006000000000000L)
     self.assertEqual(ts.nsecs(DateTime.TAI), 399006021000000000L)
     self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.UTC), 45205.125)
     self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.TAI), 45205.125 + 21.0/86400.0)
     # Following interface is deprecated
     self.assertAlmostEqual(ts.mjd(DateTime.UTC), 45205.125)
     self.assertAlmostEqual(ts.mjd(DateTime.TAI), 45205.125 + 21.0/86400.0)
开发者ID:lsst-dm,项目名称:bp,代码行数:11,代码来源:dateTime.py

示例7: testDM7622

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
    def testDM7622(self):
        """Test DM-7622: date with unix time = -1 seconds must be usable

        Note that the call in question parses the ISO string without paying
        attention to the scale (it applies the scale later),
        so the same ISO string is wanted in all cases
        (except with a trailing Z for UTC, and without for TAI and TT)
        """
        negOneSecIso = "1969-12-31T23:59:59.000000000"
        for scale in self.timeScales:
            dateStr = negOneSecIso + ("Z" if scale == DateTime.UTC else "")
            try:
                dt = DateTime(dateStr, scale)
            except Exception:
                self.fail("Date {} unusable; DM-7622 is still with us".format(dateStr, scale))
            self.assertEqual(dt.nsecs(scale), int(-1e9))
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:18,代码来源:test_dateTime.py

示例8: testGetDR7

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
    def testGetDR7(self):
        obsSdssDir = lsst.utils.getPackageDir('obs_sdss')
        butler = dafPersist.Butler(
            root=os.path.join(obsSdssDir, "tests", "data", "dr7", "runs"))
        sub = butler.subset("fpC", run=5754, camcol=3, field=280, filter="r")
        self.assertEqual(len(sub), 1)
        for ref in sub:
            im = ref.get("fpC")
            w, h = im.getWidth(), im.getHeight()
            self.assertEqual(im.__class__, lsst.afw.image.ExposureU)
            self.assertEqual(w, 2048)
            self.assertEqual(h, 1489)

            im_md = ref.get("fpC_md")
            self.assertEqual(im_md.getScalar("RUN"), 5754)
            self.assertEqual(im_md.getScalar("FRAME"), 280)
            self.assertEqual(im_md.getScalar("STRIPE"), 82)

            msk = ref.get("fpM")
            w, h = msk.getWidth(), msk.getHeight()
            self.assertEqual(msk.__class__, lsst.afw.image.Mask[lsst.afw.image.MaskPixel])
            self.assertEqual(w, 2048)
            self.assertEqual(h, 1489)

            psf = ref.get("psField")
            k = psf.getKernel()
            w, h = k.getWidth(), k.getHeight()
            self.assertEqual(psf.__class__, lsst.meas.algorithms.PcaPsf)
            self.assertEqual(w, 31)
            self.assertEqual(h, 31)

            wcs = ref.get("asTrans")
            self.assertIsInstance(wcs, SkyWcs)
            self.assertFalse(wcs.isFlipped)
            # comparison is to results from lsst.afw.image.TanWcs class
            self.assertSpherePointsAlmostEqual(wcs.pixelToSky(700, 1000),
                                               SpherePoint(343.6507738304687, -0.3509870420713227, degrees))

            tsField = ref.get("tsField")
            self.assertAlmostEqual(tsField.gain, 4.72, 2)
            self.assertAlmostEqual(tsField.airmass, 1.2815132857671601)
            self.assertAlmostEqual(tsField.exptime, 53.907456)
            predDateStart = DateTime(53664.226070589997, DateTime.MJD, DateTime.TAI)
            predDateAvg = DateTime(predDateStart.nsecs(DateTime.TAI) + int(0.5e9*tsField.exptime),
                                   DateTime.TAI)
            self.assertAlmostEqual(tsField.dateAvg.get(), predDateAvg.get())
开发者ID:lsst,项目名称:obs_sdss,代码行数:48,代码来源:test_sdss.py

示例9: testInvalid

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testInvalid(self):
     ts = DateTime()
     self.assertFalse(ts.isValid())
     for scale in self.timeScales:
         self.assertEqual(ts.nsecs(scale), DateTime.invalid_nsecs)
         for system in self.dateSystems:
             with self.assertRaises(RuntimeError):
                 ts.get(system, scale)
         with self.assertRaises(RuntimeError):
             ts.gmtime(scale)
         with self.assertRaises(RuntimeError):
             ts.timespec(scale)
         with self.assertRaises(RuntimeError):
             ts.timeval(scale)
         with self.assertRaises(RuntimeError):
             ts.toString(scale)
     self.assertEqual(repr(ts), "DateTime()")
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:19,代码来源:test_dateTime.py

示例10: setUp

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def setUp(self):
     self.butler = dafPersist.Butler(root=os.path.join(os.path.dirname(__file__), "data"))
     self.exposureTime = 15.0
     self.darkTime = 15.0
     dateObs = DateTime(49552.28496, DateTime.MJD, DateTime.TAI)
     self.dateAvg = DateTime(dateObs.nsecs(DateTime.TAI) + int(0.5e9*self.exposureTime), DateTime.TAI)
     self.boresightRaDec = SpherePoint(359.936019771151, -2.3356222648145, degrees)
     self.boresightAzAlt = SpherePoint(127.158246182602, 90 - 40.6736117075876, degrees)
     self.boresightAirmass = 1.31849492005496
     self.boresightRotAngle = -3.43228*degrees
     self.rotType = RotType.SKY
     self.obs_longitude = -70.749417*degrees
     self.obs_latitude = -30.244633*degrees
     self.obs_elevation = 2663.0
     self.weath_airTemperature = 5.0
     self.weath_airPressure = MakeRawVisitInfo.pascalFromMmHg(520.0)
     self.weath_humidity = 40.
开发者ID:lsst,项目名称:obs_lsstSim,代码行数:19,代码来源:test_getRaw.py

示例11: testIsoNoNSecs

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testIsoNoNSecs(self):
     ts = DateTime("2009-04-02T07:26:39Z", DateTime.UTC)
     self.assertEqual(ts.nsecs(DateTime.TAI), 1238657233000000000)
     self.assertEqual(ts.nsecs(DateTime.UTC), 1238657199000000000)
     self.assertEqual(ts.toString(ts.UTC), "2009-04-02T07:26:39.000000000Z")
     self.assertTrue(ts.isValid())
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:8,代码来源:test_dateTime.py

示例12: testCrossBoundaryNsecs

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testCrossBoundaryNsecs(self):
     ts = DateTime(631151998000000000, DateTime.UTC)
     self.assertEqual(ts.nsecs(DateTime.UTC), 631151998000000000)
     self.assertEqual(ts.nsecs(DateTime.TAI), 631152022000000000)
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:6,代码来源:test_dateTime.py

示例13: testBoundaryMJD

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testBoundaryMJD(self):
     ts = DateTime(47892.0, DateTime.MJD, DateTime.UTC)
     self.assertEqual(ts.nsecs(DateTime.UTC), 631152000000000000)
     self.assertEqual(ts.nsecs(DateTime.TAI), 631152025000000000)
     self.assertEqual(ts.get(DateTime.MJD, DateTime.UTC), 47892.0)
开发者ID:HyperSuprime-Cam,项目名称:daf_base,代码行数:7,代码来源:test_dateTime.py

示例14: testIsoBasic

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testIsoBasic(self):
     ts = DateTime("20090402T072639.314159265Z")
     self.assertEqual(ts.nsecs(DateTime.TAI), 1238657233314159265L)
     self.assertEqual(ts.nsecs(DateTime.UTC), 1238657199314159265L)
     self.assertEqual(ts.toString(), "2009-04-02T07:26:39.314159265Z")
开发者ID:jonathansick-shadow,项目名称:daf_base,代码行数:7,代码来源:dateTime.py

示例15: testNsecsTAI

# 需要导入模块: from lsst.daf.base import DateTime [as 别名]
# 或者: from lsst.daf.base.DateTime import nsecs [as 别名]
 def testNsecsTAI(self):
     ts = DateTime(1192755506000000000L, DateTime.TAI)
     self.assertEqual(ts.nsecs(DateTime.UTC), 1192755473000000000L)
     self.assertEqual(ts.nsecs(DateTime.TAI), 1192755506000000000L)
     self.assertEqual(ts.nsecs(), 1192755506000000000L)
     self.assertAlmostEqual(ts.get(DateTime.MJD, DateTime.UTC), 54392.040196759262)
开发者ID:jonathansick-shadow,项目名称:daf_base,代码行数:8,代码来源:dateTime.py


注:本文中的lsst.daf.base.DateTime.nsecs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。