@@ -0,0 +1,1 | |||
|
1 | You should install "digital_rf_hdf5" module if you want to read USRP data |
@@ -1,1 +1,1 | |||
|
1 |
<Project description="A schain project" id="191" name="project"><ReadUnit datatype="Voltage" id="1911" inputId="0" name="VoltageReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="VoltageReader" /><Parameter format="str" id="191112" name="path" value="/home/nanosat/schain" /><Parameter format="date" id="191113" name="startDate" value="1970/01/01" /><Parameter format="date" id="191114" name="endDate" value="2017/12/31" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="walk" value="1" /><Parameter format="int" id="191119" name="verbose" value="1" /><Parameter format="int" id="191120" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="Voltage" id="1912" inputId="1911" name="VoltageProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="ProfileSelector" priority="2" type="other"><Parameter format="intlist" id="191221" name="profileRangeList" value="120,183" /></Operation><Operation id="19123" name="RTIPlot" priority="3" type=" |
|
|
1 | <Project description="A schain project" id="191" name="project"><ReadUnit datatype="VoltageReader" id="1911" inputId="0" name="VoltageReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="VoltageReader" /><Parameter format="str" id="191112" name="path" value="/home/nanosat/schain" /><Parameter format="date" id="191113" name="startDate" value="1970/01/01" /><Parameter format="date" id="191114" name="endDate" value="2017/12/31" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="walk" value="1" /><Parameter format="int" id="191119" name="verbose" value="1" /><Parameter format="int" id="191120" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="VoltageProc" id="1912" inputId="1911" name="VoltageProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="ProfileSelector" priority="2" type="other"><Parameter format="intlist" id="191221" name="profileRangeList" value="120,183" /></Operation><Operation id="19123" name="RTIPlot" priority="3" type="other"><Parameter format="str" id="191231" name="wintitle" value="Jicamarca Radio Observatory" /><Parameter format="int" id="191232" name="showprofile" value="0" /><Parameter format="int" id="191233" name="xmin" value="0" /><Parameter format="int" id="191234" name="xmax" value="24" /><Parameter format="str" id="191235" name="figpath" value="/home/nanosat/schain/figs" /><Parameter format="int" id="191236" name="wr_period" value="5" /><Parameter format="int" id="191237" name="exp_code" value="22" /></Operation></ProcUnit></Project> No newline at end of file |
@@ -11,7 +11,6 import numpy | |||
|
11 | 11 | import fnmatch |
|
12 | 12 | import inspect |
|
13 | 13 | import time, datetime |
|
14 | #import h5py | |
|
15 | 14 | import traceback |
|
16 | 15 | |
|
17 | 16 | try: |
@@ -1274,99 +1273,112 class JRODataReader(JRODataIO): | |||
|
1274 | 1273 | skip=None, |
|
1275 | 1274 | cursor=None, |
|
1276 | 1275 | warnings=True, |
|
1277 |
verbose=True |
|
|
1278 | ||
|
1279 | if path == None: | |
|
1280 | raise ValueError, "[Reading] The path is not valid" | |
|
1281 | ||
|
1282 | if ext == None: | |
|
1283 |
|
|
|
1284 | ||
|
1285 | if online: | |
|
1286 | print "[Reading] Searching files in online mode..." | |
|
1287 | ||
|
1288 | for nTries in range( self.nTries ): | |
|
1289 | fullpath, foldercounter, file, year, doy, set = self.__searchFilesOnLine(path=path, expLabel=expLabel, ext=ext, walk=walk, set=set) | |
|
1290 | ||
|
1291 | if fullpath: | |
|
1292 | break | |
|
1293 | ||
|
1294 | print '[Reading] Waiting %0.2f sec for an valid file in %s: try %02d ...' % (self.delay, path, nTries+1) | |
|
1295 | sleep( self.delay ) | |
|
1296 | ||
|
1297 | if not(fullpath): | |
|
1298 | print "[Reading] There 'isn't any valid file in %s" % path | |
|
1299 |
|
|
|
1300 | ||
|
1301 | self.year = year | |
|
1302 | self.doy = doy | |
|
1303 | self.set = set - 1 | |
|
1304 | self.path = path | |
|
1305 | self.foldercounter = foldercounter | |
|
1306 | last_set = None | |
|
1276 | verbose=True, | |
|
1277 | server=None): | |
|
1278 | ||
|
1279 | if server is not None: | |
|
1280 | server = kwargs.get('server', 'zmq.pipe') | |
|
1281 | if 'tcp://' in server: | |
|
1282 | address = server | |
|
1283 | else: | |
|
1284 | address = 'ipc:///tmp/%s' % server | |
|
1285 | self.address = address | |
|
1286 | self.context = zmq.Context() | |
|
1287 | self.receiver = self.context.socket(zmq.PULL) | |
|
1288 | self.receiver.bind(self.address) | |
|
1289 | time.sleep(0.5) | |
|
1290 | print '[Starting] ReceiverData from {}'.format(self.address) | |
|
1291 | else: | |
|
1292 | if path == None: | |
|
1293 | raise ValueError, "[Reading] The path is not valid" | |
|
1294 | ||
|
1295 | if ext == None: | |
|
1296 | ext = self.ext | |
|
1297 | ||
|
1298 | if online: | |
|
1299 | print "[Reading] Searching files in online mode..." | |
|
1300 | ||
|
1301 | for nTries in range( self.nTries ): | |
|
1302 | fullpath, foldercounter, file, year, doy, set = self.__searchFilesOnLine(path=path, expLabel=expLabel, ext=ext, walk=walk, set=set) | |
|
1303 | ||
|
1304 | if fullpath: | |
|
1305 | break | |
|
1306 | ||
|
1307 | print '[Reading] Waiting %0.2f sec for an valid file in %s: try %02d ...' % (self.delay, path, nTries+1) | |
|
1308 | sleep( self.delay ) | |
|
1309 | ||
|
1310 | if not(fullpath): | |
|
1311 | print "[Reading] There 'isn't any valid file in %s" % path | |
|
1312 | return | |
|
1313 | ||
|
1314 | self.year = year | |
|
1315 | self.doy = doy | |
|
1316 | self.set = set - 1 | |
|
1317 | self.path = path | |
|
1318 | self.foldercounter = foldercounter | |
|
1319 | last_set = None | |
|
1320 | else: | |
|
1321 | print "[Reading] Searching files in offline mode ..." | |
|
1322 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, | |
|
1323 | startTime=startTime, endTime=endTime, | |
|
1324 | set=set, expLabel=expLabel, ext=ext, | |
|
1325 | walk=walk, cursor=cursor, | |
|
1326 | skip=skip, queue=queue) | |
|
1307 | 1327 | |
|
1308 | else: | |
|
1309 | print "[Reading] Searching files in offline mode ..." | |
|
1310 | pathList, filenameList = self.__searchFilesOffLine(path, startDate=startDate, endDate=endDate, | |
|
1311 |
|
|
|
1312 | set=set, expLabel=expLabel, ext=ext, | |
|
1313 | walk=walk, cursor=cursor, | |
|
1314 | skip=skip, queue=queue) | |
|
1328 | if not(pathList): | |
|
1329 | # print "[Reading] No *%s files in %s (%s - %s)"%(ext, path, | |
|
1330 | # datetime.datetime.combine(startDate,startTime).ctime(), | |
|
1331 | # datetime.datetime.combine(endDate,endTime).ctime()) | |
|
1315 | 1332 | |
|
1316 | if not(pathList): | |
|
1317 | # print "[Reading] No *%s files in %s (%s - %s)"%(ext, path, | |
|
1318 | # datetime.datetime.combine(startDate,startTime).ctime(), | |
|
1319 | # datetime.datetime.combine(endDate,endTime).ctime()) | |
|
1333 | # sys.exit(-1) | |
|
1320 | 1334 | |
|
1321 |
|
|
|
1335 | self.fileIndex = -1 | |
|
1336 | self.pathList = [] | |
|
1337 | self.filenameList = [] | |
|
1338 | return | |
|
1322 | 1339 | |
|
1323 | 1340 | self.fileIndex = -1 |
|
1324 |
self.pathList = |
|
|
1325 |
self.filenameList = |
|
|
1326 | return | |
|
1327 | ||
|
1328 | self.fileIndex = -1 | |
|
1329 | self.pathList = pathList | |
|
1330 |
self. |
|
|
1331 | file_name = os.path.basename(filenameList[-1]) | |
|
1332 | basename, ext = os.path.splitext(file_name) | |
|
1333 | last_set = int(basename[-3:]) | |
|
1334 | ||
|
1335 | self.online = online | |
|
1336 | self.realtime = realtime | |
|
1337 | self.delay = delay | |
|
1338 | ext = ext.lower() | |
|
1339 | self.ext = ext | |
|
1340 | self.getByBlock = getblock | |
|
1341 | self.nTxs = nTxs | |
|
1342 |
self.st |
|
|
1343 | self.endTime = endTime | |
|
1344 | ||
|
1345 | #Added----------------- | |
|
1346 | self.selBlocksize = blocksize | |
|
1347 | self.selBlocktime = blocktime | |
|
1348 | ||
|
1349 | # Verbose----------- | |
|
1350 | self.verbose = verbose | |
|
1351 | self.warnings = warnings | |
|
1341 | self.pathList = pathList | |
|
1342 | self.filenameList = filenameList | |
|
1343 | file_name = os.path.basename(filenameList[-1]) | |
|
1344 | basename, ext = os.path.splitext(file_name) | |
|
1345 | last_set = int(basename[-3:]) | |
|
1346 | ||
|
1347 | self.online = online | |
|
1348 | self.realtime = realtime | |
|
1349 | self.delay = delay | |
|
1350 | ext = ext.lower() | |
|
1351 | self.ext = ext | |
|
1352 | self.getByBlock = getblock | |
|
1353 | self.nTxs = nTxs | |
|
1354 | self.startTime = startTime | |
|
1355 | self.endTime = endTime | |
|
1356 | ||
|
1357 | #Added----------------- | |
|
1358 | self.selBlocksize = blocksize | |
|
1359 | self.selBlocktime = blocktime | |
|
1360 | ||
|
1361 | # Verbose----------- | |
|
1362 | self.verbose = verbose | |
|
1363 | self.warnings = warnings | |
|
1352 | 1364 | |
|
1353 | if not(self.setNextFile()): | |
|
1354 | if (startDate!=None) and (endDate!=None): | |
|
1355 | print "[Reading] No files in range: %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) | |
|
1356 | elif startDate != None: | |
|
1357 | print "[Reading] No files in range: %s" %(datetime.datetime.combine(startDate,startTime).ctime()) | |
|
1358 | else: | |
|
1359 | print "[Reading] No files" | |
|
1365 | if not(self.setNextFile()): | |
|
1366 | if (startDate!=None) and (endDate!=None): | |
|
1367 | print "[Reading] No files in range: %s - %s" %(datetime.datetime.combine(startDate,startTime).ctime(), datetime.datetime.combine(endDate,endTime).ctime()) | |
|
1368 | elif startDate != None: | |
|
1369 | print "[Reading] No files in range: %s" %(datetime.datetime.combine(startDate,startTime).ctime()) | |
|
1370 | else: | |
|
1371 | print "[Reading] No files" | |
|
1360 | 1372 | |
|
1361 | self.fileIndex = -1 | |
|
1362 | self.pathList = [] | |
|
1363 | self.filenameList = [] | |
|
1364 | return | |
|
1373 | self.fileIndex = -1 | |
|
1374 | self.pathList = [] | |
|
1375 | self.filenameList = [] | |
|
1376 | return | |
|
1365 | 1377 | |
|
1366 | # self.getBasicHeader() | |
|
1378 | # self.getBasicHeader() | |
|
1367 | 1379 | |
|
1368 | if last_set != None: | |
|
1369 | self.dataOut.last_block = last_set * self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock | |
|
1380 | if last_set != None: | |
|
1381 | self.dataOut.last_block = last_set * self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock | |
|
1370 | 1382 | return |
|
1371 | 1383 | |
|
1372 | 1384 | def getBasicHeader(self): |
@@ -1457,6 +1469,7 class JRODataReader(JRODataIO): | |||
|
1457 | 1469 | skip=None, |
|
1458 | 1470 | cursor=None, |
|
1459 | 1471 | warnings=True, |
|
1472 | server=None, | |
|
1460 | 1473 | verbose=True, **kwargs): |
|
1461 | 1474 | |
|
1462 | 1475 | if not(self.isConfig): |
@@ -1481,10 +1494,13 class JRODataReader(JRODataIO): | |||
|
1481 | 1494 | skip=skip, |
|
1482 | 1495 | cursor=cursor, |
|
1483 | 1496 | warnings=warnings, |
|
1497 | server=None, | |
|
1484 | 1498 | verbose=verbose) |
|
1485 | 1499 | self.isConfig = True |
|
1486 | ||
|
1487 | self.getData() | |
|
1500 | if self.server is None: | |
|
1501 | self.getData() | |
|
1502 | else: | |
|
1503 | self.getFromZMQ() | |
|
1488 | 1504 | |
|
1489 | 1505 | class JRODataWriter(JRODataIO): |
|
1490 | 1506 |
@@ -10,6 +10,7 from jroIO_base import LOCALTIME, JRODataReader, JRODataWriter | |||
|
10 | 10 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
11 | 11 | from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader |
|
12 | 12 | from schainpy.model.data.jrodata import Voltage |
|
13 | import zmq | |
|
13 | 14 | # from _sha import blocksize |
|
14 | 15 | |
|
15 | 16 | class VoltageReader(JRODataReader, ProcessingUnit): |
@@ -301,6 +302,12 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
301 | 302 | |
|
302 | 303 | return |
|
303 | 304 | |
|
305 | ||
|
306 | def getFromZMQ(self): | |
|
307 | self.dataOut = self.receiver.recv_pyobj() | |
|
308 | print '[Receiving] {} - {}'.format(self.dataOut.type, | |
|
309 | self.dataOut.datatime.ctime()) | |
|
310 | ||
|
304 | 311 | def getData(self): |
|
305 | 312 | """ |
|
306 | 313 | getData obtiene una unidad de datos del buffer de lectura, un perfil, y la copia al objeto self.dataOut |
General Comments 0
You need to be logged in to leave comments.
Login now