LATfunctions.py

Go to the documentation of this file.
00001 #!/usr/local/bin/python
00002 #
00003 #                               Copyright 2005
00004 #                                     by
00005 #                        The Board of Trustees of the
00006 #                     Leland Stanford Junior University.
00007 #                            All rights reserved.
00008 #
00009 
00010 __facility__ = "Online"
00011 __abstract__ = "LAT-related useful functions"
00012 __author__   = "S. Tuvi <Stuvi@SLAC.Stanford.edu> SLAC - GLAST LAT I&T/Online"
00013 __date__     = "2005/12/20 00:00:00"
00014 __updated__  = "$Date: 2006/04/27 02:07:28 $"
00015 __version__  = "$Revision: 1.2 $"
00016 __release__  = "$Name: HEAD $"
00017 __credits__  = "SLAC"
00018 
00019 import LICOS.copyright_SLAC
00020 
00021 import datetime, calendar, time
00022 
00023 LAT_EPOCH_datetime = calendar.timegm( time.strptime( '2001-01-01 00:00:00', '%Y-%m-%d %H:%M:%S' ) )
00024 
00025 # define a utility function to convert a LAT timestamp to a datetime object
00026 def utcfromtimestamp( secs, usecs ):
00027     # get floating-point seconds including the epoch
00028     tstamp = float( secs ) + ( float( usecs ) / 1000000.0 )  + LAT_EPOCH_datetime
00029 
00030     # return the corresponding datetime object
00031     return datetime.datetime.utcfromtimestamp( tstamp )

Generated on Thu Apr 27 20:52:42 2006 for LICOS L02-01-00 by doxygen 1.4.6-NO