CMS 3D CMS Logo

Public Member Functions | Public Attributes

lumiTime::lumiTime Class Reference

List of all members.

Public Member Functions

def __init__
def DatetimeToStr
def LSDuration
def OrbitDuration
def OrbitToLocalTimestamp
def OrbitToTime
def OrbitToTimeStr
def OrbitToUTCTimestamp
def StrToDatetime

Public Attributes

 bunchspace_s
 bunchspace_us
 coraltimefm
 nbx
 pydatetimefm

Detailed Description

Definition at line 4 of file lumiTime.py.


Constructor & Destructor Documentation

def lumiTime::lumiTime::__init__ (   self)

Definition at line 5 of file lumiTime.py.

00006                       :
00007         self.coraltimefm='MM/DD/YY HH24:MI:SS.FF6'
00008         self.pydatetimefm='%m/%d/%y %H:%M:%S.%f'
00009         self.nbx=3564
00010         self.bunchspace_us=0.025 #in microseconds
00011         self.bunchspace_s=25e-09 #in seconds
        

Member Function Documentation

def lumiTime::lumiTime::DatetimeToStr (   self,
  timeValue,
  customfm = '' 
)
convert python datetime to string timestamp

Definition at line 57 of file lumiTime.py.

00058                                                  :
00059         '''convert python datetime to string timestamp
00060         '''
00061         result=''
00062         try:
00063             if not customfm:
00064                 result=timeValue.strftime(self.pydatetimefm)
00065             else:
00066                 result=timeValue.strftime(customfm)
00067         except Exception,er:
00068             print str(er)
        return result
def lumiTime::lumiTime::LSDuration (   self,
  norbits 
)

Definition at line 12 of file lumiTime.py.

00013                                 :
00014         return timedelta(microseconds=(self.nbx*norbits*self.bunchspace_us))
    
def lumiTime::lumiTime::OrbitDuration (   self)

Definition at line 15 of file lumiTime.py.

00016                            :
00017         return timedelta(microseconds=(self.nbx*self.bunchspace_us))
    
def lumiTime::lumiTime::OrbitToLocalTimestamp (   self,
  begStrTime,
  orbitnumber,
  begorbit = 0 
)
given a orbit number, return its corresponding unixtimestamp. Default run begin time counting from orbit=0

Definition at line 28 of file lumiTime.py.

00029                                                                      :
00030         '''
00031         given a orbit number, return its corresponding unixtimestamp. Default run begin time counting from orbit=0
00032         '''
00033         os.environ['TZ']='CET'
00034         time.tzset()
00035         orbittime=self.OrbitToTime(begStrTime,orbitnumber,begorbit)
00036         return time.mktime(orbittime.timetuple())+orbittime.microsecond/1e6

def lumiTime::lumiTime::OrbitToTime (   self,
  begStrTime,
  orbitnumber,
  begorbit = 0 
)
given a orbit number, return its corresponding time. Default run begin time counting from orbit=0

Definition at line 23 of file lumiTime.py.

00024                                                            :
00025         '''
00026         given a orbit number, return its corresponding time. Default run begin time counting from orbit=0
00027         '''
        return self.StrToDatetime(begStrTime)+(orbitnumber-begorbit)*self.OrbitDuration()
def lumiTime::lumiTime::OrbitToTimeStr (   self,
  begStrTime,
  orbitnumber,
  begorbit = 0 
)
given a orbit number, return its corresponding time. Assuming begin time has orbit=0

Definition at line 18 of file lumiTime.py.

00019                                                               :
00020         '''
00021         given a orbit number, return its corresponding time. Assuming begin time has orbit=0
00022         '''
        return self.DatetimeToStr(self.StrToDatetime(begStrTime)+(orbitnumber-begorbit)*self.OrbitDuration())
def lumiTime::lumiTime::OrbitToUTCTimestamp (   self,
  begStrTime,
  orbitnumber,
  begorbit = 0 
)
given a orbit number, return its corresponding unixtimestamp. Default run begin time counting from orbit=0

Definition at line 37 of file lumiTime.py.

00038                                                                    :
00039         '''
00040         given a orbit number, return its corresponding unixtimestamp. Default run begin time counting from orbit=0
00041         '''
00042         os.environ['TZ']='UTC'
00043         time.tzset()
00044         orbittime=self.OrbitToTime(begStrTime,orbitnumber,begorbit)
        return time.mktime(orbittime.timetuple())+(orbittime.microsecond/1e6)
def lumiTime::lumiTime::StrToDatetime (   self,
  strTime,
  customfm = '' 
)
convert string timestamp to python datetime

Definition at line 45 of file lumiTime.py.

00046                                                :
00047         '''convert string timestamp to python datetime
00048         '''
00049         result=''
00050         try:
00051             if not customfm:
00052                 result=datetime.strptime(strTime,self.pydatetimefm)
00053             else:
00054                 result=datetime.strptime(strTime,customfm)
00055         except Exception,er:
00056             print str(er)
        return result

Member Data Documentation

Definition at line 5 of file lumiTime.py.

Definition at line 5 of file lumiTime.py.

Definition at line 5 of file lumiTime.py.

Definition at line 5 of file lumiTime.py.

Definition at line 5 of file lumiTime.py.