Commit 99943c8a authored by marc's avatar marc
Browse files

inital commit

parents
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>measurements</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?eclipse-pydev version="1.0"?><pydev_project>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.7</pydev_property>
</pydev_project>
from __future__ import print_function
import logging
from configparser import ConfigParser
import os.path
import time
config = ConfigParser()
config.readfp(open(os.path.join(os.path.dirname(__file__), 'measurements.ini')))
logging.basicConfig(level=logging.DEBUG)
class measurements():
def __init__(self,tool=None, integrationTime=None, outputFile=None, metaData=None):
'''
Initializes a measurement instance.
'''
self._tool = tool
self._tools = []
self._integrationTime = integrationTime
self._outputFile = outputFile
self._startTime = time.strftime("%Y%m%d-%h%m%s")
self._staticMetaData = {"Observer":"CAMRAS","Date" : self._startTime}
self._dynamicMetaData = None
'''
Read tools from ini file
'''
self._tools.append(config.get('Tools','DumpWide'))
self._tools.append(config.get('Tools','Int32Bin'))
self._tools.append(config.get('Tools','PulsarRecord'))
self._tools.append(config.get('Tools','RawRecord'))
def getTools(self):
'''
read the list of tools to output measurememnts
'''
logging.info('List of measument tools: {}'.format(self._tools))
return(self._tools)
def getIntegrationTime(self):
'''
read the integration time
'''
logging.info('Integration time is set to: {}'.format(self._integrationTime))
return(self._integrationTime)
def getMetaData(self):
'''
read meta data
'''
logging.info('Static meta data is: {}'.format(self._staticMetaData))
return(self._staticMetaData)
def setTool(self, measProg):
'''
Define the required tool to perform the measurement
'''
self._tool = measProg
logging.info('Used measument tool set to: {}'.format(self._tool))
def setIntegrationTime(self, integrationTime):
self._integrationTime = integrationTime
logging.info('Integration time set to: {}'.format(self._integrationTime))
def setMetaData(self,metaData):
self._staticMetaData = metaData
self._dynamicMetaData = None
if __name__ == '__main__':
myMeas = measurements()
myMeas.getMetaData()
for tool in myMeas.getTools():
myMeas.setTool(tool)
myMeas.setIntegrationTime(2)
myMeas.getIntegrationTime()
\ No newline at end of file
[Tools]
DumpWide: dumpwide
Int32Bin: int32bin
PulsarRecord: pulsarrecord
RawRecord: rawrecord
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment