##// END OF EJS Templates
Python 2to3, Spectra (all operations) working
Python 2to3, Spectra (all operations) working

File last commit:

r1167:1f521b07c958
r1167:1f521b07c958
Show More
jroIO_base.py
1825 lines | 53.3 KiB | text/x-python | PythonLexer
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 '''
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 Created on Jul 2, 2014
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 @author: roj-idl71
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 '''
import os
import sys
import glob
import time
import numpy
import fnmatch
José Chávez
1.0
r944 import inspect
José Chávez
merge revisado
r1074 import time
import datetime
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 import traceback
José Chávez
pruebas jrovoltage
r963 import zmq
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 try:
from gevent import sleep
except:
from time import sleep
add multiSchain (@jchavez)
r892
Alarm working ok
r1130 import schainpy.admin
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 from schainpy.model.data.jroheaderIO import get_dtype_index, get_numpy_dtype, get_procflag_dtype, get_dtype_width
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112 from schainpy.utils import log
Raise Warning when no more files
r1150 import schainpy.admin
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 LOCALTIME = True
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 def isNumber(cad):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
Chequea si el conjunto de caracteres que componen un string puede ser convertidos a un numero.
add multiSchain (@jchavez)
r892 Excepciones:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Si un determinado string no puede ser convertido a numero
Input:
str, string al cual se le analiza para determinar si convertible a un numero o no
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
True : si el string es uno numerico
False : no es un string numerico
"""
try:
José Chávez
merge revisado
r1074 float(cad)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return True
except:
return False
José Chávez
merge revisado
r1074
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 def isFileInEpoch(filename, startUTSeconds, endUTSeconds):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
Esta funcion determina si un archivo de datos se encuentra o no dentro del rango de fecha especificado.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Inputs:
filename : nombre completo del archivo de datos en formato Jicamarca (.r)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 startUTSeconds : fecha inicial del rango seleccionado. La fecha esta dada en
segundos contados desde 01/01/1970.
endUTSeconds : fecha final del rango seleccionado. La fecha esta dada en
segundos contados desde 01/01/1970.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
Boolean : Retorna True si el archivo de datos contiene datos en el rango de
fecha especificado, de lo contrario retorna False.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Excepciones:
Si el archivo no existe o no puede ser abierto
Si la cabecera no puede ser leida.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
basicHeaderObj = BasicHeader(LOCALTIME)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
José Chávez
merge revisado
r1074 fp = open(filename, 'rb')
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 except IOError:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("The file %s can't be opened" % (filename))
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 sts = basicHeaderObj.read(fp)
fp.close()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(sts):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("Skipping the file %s because it has not a valid header" % (filename))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not ((startUTSeconds <= basicHeaderObj.utc) and (endUTSeconds > basicHeaderObj.utc)):
return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
merge revisado
r1074
Miguel Valdez
Filtering block by time
r759 def isTimeInRange(thisTime, startTime, endTime):
if endTime >= startTime:
if (thisTime < startTime) or (thisTime > endTime):
return 0
return 1
else:
if (thisTime < startTime) and (thisTime > endTime):
return 0
return 1
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074
Miguel Valdez
jroIO_base.py: Compare dates when startTime > endTime
r652 def isFileInTimeRange(filename, startDate, endDate, startTime, endTime):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
Retorna 1 si el archivo de datos se encuentra dentro del rango de horas especificado.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Inputs:
filename : nombre completo del archivo de datos en formato Jicamarca (.r)
add multiSchain (@jchavez)
r892
Miguel Valdez
jroIO_base.py: Compare dates when startTime > endTime
r652 startDate : fecha inicial del rango seleccionado en formato datetime.date
add multiSchain (@jchavez)
r892
Miguel Valdez
jroIO_base.py: Compare dates when startTime > endTime
r652 endDate : fecha final del rango seleccionado en formato datetime.date
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 startTime : tiempo inicial del rango seleccionado en formato datetime.time
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 endTime : tiempo final del rango seleccionado en formato datetime.time
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
Boolean : Retorna True si el archivo de datos contiene datos en el rango de
fecha especificado, de lo contrario retorna False.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Excepciones:
Si el archivo no existe o no puede ser abierto
Si la cabecera no puede ser leida.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
José Chávez
merge revisado
r1074 fp = open(filename, 'rb')
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 except IOError:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("The file %s can't be opened" % (filename))
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 return None
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 firstBasicHeaderObj = BasicHeader(LOCALTIME)
systemHeaderObj = SystemHeader()
radarControllerHeaderObj = RadarControllerHeader()
processingHeaderObj = ProcessingHeader()
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 lastBasicHeaderObj = BasicHeader(LOCALTIME)
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 sts = firstBasicHeaderObj.read(fp)
add multiSchain (@jchavez)
r892
Miguel Valdez
jroIO_base: File size is verified
r780 if not(sts):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Skipping the file %s because it has not a valid header" % (filename))
Miguel Valdez
jroIO_base: File size is verified
r780 return None
add multiSchain (@jchavez)
r892
Miguel Valdez
r803 if not systemHeaderObj.read(fp):
return None
add multiSchain (@jchavez)
r892
Miguel Valdez
r803 if not radarControllerHeaderObj.read(fp):
return None
add multiSchain (@jchavez)
r892
Miguel Valdez
r803 if not processingHeaderObj.read(fp):
return None
add multiSchain (@jchavez)
r892
Miguel Valdez
jroIO_base: File size is verified
r780 filesize = os.path.getsize(filename)
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 offset = processingHeaderObj.blockSize + 24 # header size
add multiSchain (@jchavez)
r892
Miguel Valdez
jroIO_base: File size is verified
r780 if filesize <= offset:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] %s: This file has not enough data" % filename)
Miguel Valdez
jroIO_base: File size is verified
r780 return None
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 fp.seek(-offset, 2)
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 sts = lastBasicHeaderObj.read(fp)
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 fp.close()
add multiSchain (@jchavez)
r892
Miguel Valdez
jroIO_base: File size is verified
r780 thisDatetime = lastBasicHeaderObj.datatime
thisTime_last_block = thisDatetime.time()
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 thisDatetime = firstBasicHeaderObj.datatime
thisDate = thisDatetime.date()
thisTime_first_block = thisDatetime.time()
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # General case
Miguel Valdez
isFileinTimeRange: startTime can be greater than endTime
r648 # o>>>>>>>>>>>>>><<<<<<<<<<<<<<o
#-----------o----------------------------o-----------
# startTime endTime
add multiSchain (@jchavez)
r892
Miguel Valdez
isFileinTimeRange: startTime can be greater than endTime
r648 if endTime >= startTime:
Miguel Valdez
Filtering block by time
r759 if (thisTime_last_block < startTime) or (thisTime_first_block > endTime):
Miguel Valdez
isFileinTimeRange: startTime can be greater than endTime
r648 return None
add multiSchain (@jchavez)
r892
Miguel Valdez
isFileinTimeRange: startTime can be greater than endTime
r648 return thisDatetime
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # If endTime < startTime then endTime belongs to the next day
add multiSchain (@jchavez)
r892
Miguel Valdez
isFileinTimeRange: startTime can be greater than endTime
r648 #<<<<<<<<<<<o o>>>>>>>>>>>
#-----------o----------------------------o-----------
# endTime startTime
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 if (thisDate == startDate) and (thisTime_last_block < startTime):
Miguel Valdez
jroIO_base.py: Compare dates when startTime > endTime
r652 return None
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 if (thisDate == endDate) and (thisTime_first_block > endTime):
Miguel Valdez
jroIO_base.py: Compare dates when startTime > endTime
r652 return None
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 if (thisTime_last_block < startTime) and (thisTime_first_block > endTime):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return thisDatetime
José Chávez
merge revisado
r1074
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 def isFolderInDateRange(folder, startDate=None, endDate=None):
"""
Retorna 1 si el archivo de datos se encuentra dentro del rango de horas especificado.
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 Inputs:
folder : nombre completo del directorio.
Su formato deberia ser "/path_root/?YYYYDDD"
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 siendo:
YYYY : Anio (ejemplo 2015)
DDD : Dia del anio (ejemplo 305)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 startDate : fecha inicial del rango seleccionado en formato datetime.date
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 endDate : fecha final del rango seleccionado en formato datetime.date
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 Return:
Boolean : Retorna True si el archivo de datos contiene datos en el rango de
fecha especificado, de lo contrario retorna False.
Excepciones:
Si el directorio no tiene el formato adecuado
"""
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 basename = os.path.basename(folder)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if not isRadarFolder(basename):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("The folder %s has not the rigth format" % folder)
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 return 0
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if startDate and endDate:
thisDate = getDateFromRadarFolder(basename)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if thisDate < startDate:
return 0
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if thisDate > endDate:
return 0
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 return 1
José Chávez
merge revisado
r1074
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 def isFileInDateRange(filename, startDate=None, endDate=None):
"""
Retorna 1 si el archivo de datos se encuentra dentro del rango de horas especificado.
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 Inputs:
filename : nombre completo del archivo de datos en formato Jicamarca (.r)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 Su formato deberia ser "?YYYYDDDsss"
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 siendo:
YYYY : Anio (ejemplo 2015)
DDD : Dia del anio (ejemplo 305)
sss : set
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 startDate : fecha inicial del rango seleccionado en formato datetime.date
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 endDate : fecha final del rango seleccionado en formato datetime.date
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 Return:
Boolean : Retorna True si el archivo de datos contiene datos en el rango de
fecha especificado, de lo contrario retorna False.
Excepciones:
Si el archivo no tiene el formato adecuado
"""
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 basename = os.path.basename(filename)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if not isRadarFile(basename):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("The filename %s has not the rigth format" % filename)
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 return 0
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if startDate and endDate:
thisDate = getDateFromRadarFile(basename)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if thisDate < startDate:
return 0
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if thisDate > endDate:
return 0
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 return 1
José Chávez
merge revisado
r1074
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def getFileFromSet(path, ext, set):
validFilelist = []
fileList = os.listdir(path)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 # 0 1234 567 89A BCDE
# H YYYY DDD SSS .ext
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for thisFile in fileList:
try:
year = int(thisFile[1:5])
José Chávez
merge revisado
r1074 doy = int(thisFile[5:8])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 except:
continue
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (os.path.splitext(thisFile)[-1].lower() != ext.lower()):
continue
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 validFilelist.append(thisFile)
José Chávez
merge revisado
r1074 myfile = fnmatch.filter(
validFilelist, '*%4.4d%3.3d%3.3d*' % (year, doy, set))
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if len(myfile) != 0:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return myfile[0]
else:
José Chávez
merge revisado
r1074 filename = '*%4.4d%3.3d%3.3d%s' % (year, doy, set, ext.lower())
George Yong
Python 2to3, Spectra (all operations) working
r1167 print('the filename %s does not exist' % filename)
print('...going to the last file: ')
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if validFilelist:
José Chávez
merge revisado
r1074 validFilelist = sorted(validFilelist, key=str.lower)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return validFilelist[-1]
return None
José Chávez
merge revisado
r1074
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def getlastFileFromPath(path, ext):
"""
Depura el fileList dejando solo los que cumplan el formato de "PYYYYDDDSSS.ext"
add multiSchain (@jchavez)
r892 al final de la depuracion devuelve el ultimo file de la lista que quedo.
Input:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fileList : lista conteniendo todos los files (sin path) que componen una determinada carpeta
add multiSchain (@jchavez)
r892 ext : extension de los files contenidos en una carpeta
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
El ultimo file de una determinada carpeta, no se considera el path.
"""
validFilelist = []
fileList = os.listdir(path)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 # 0 1234 567 89A BCDE
# H YYYY DDD SSS .ext
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for thisFile in fileList:
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 year = thisFile[1:5]
if not isNumber(year):
continue
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 doy = thisFile[5:8]
if not isNumber(doy):
continue
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 year = int(year)
doy = int(doy)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (os.path.splitext(thisFile)[-1].lower() != ext.lower()):
continue
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 validFilelist.append(thisFile)
if validFilelist:
José Chávez
merge revisado
r1074 validFilelist = sorted(validFilelist, key=str.lower)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return validFilelist[-1]
return None
José Chávez
merge revisado
r1074
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def checkForRealPath(path, foldercounter, year, doy, set, ext):
"""
Por ser Linux Case Sensitive entonces checkForRealPath encuentra el nombre correcto de un path,
Prueba por varias combinaciones de nombres entre mayusculas y minusculas para determinar
el path exacto de un determinado file.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Example :
nombre correcto del file es .../.../D2009307/P2009307367.ext
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Entonces la funcion prueba con las siguientes combinaciones
.../.../y2009307367.ext
.../.../Y2009307367.ext
.../.../x2009307/y2009307367.ext
.../.../x2009307/Y2009307367.ext
.../.../X2009307/y2009307367.ext
.../.../X2009307/Y2009307367.ext
add multiSchain (@jchavez)
r892 siendo para este caso, la ultima combinacion de letras, identica al file buscado
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
add multiSchain (@jchavez)
r892 Si encuentra la cobinacion adecuada devuelve el path completo y el nombre del file
caso contrario devuelve None como path y el la ultima combinacion de nombre en mayusculas
para el filename
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
fullfilename = None
find_flag = False
filename = None
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 prefixDirList = [None, 'd', 'D']
if ext.lower() == ".r": # voltage
prefixFileList = ['d', 'D']
elif ext.lower() == ".pdata": # spectra
prefixFileList = ['p', 'P']
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
return None, filename
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # barrido por las combinaciones posibles
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for prefixDir in prefixDirList:
thispath = path
if prefixDir != None:
José Chávez
merge revisado
r1074 # formo el nombre del directorio xYYYYDDD (x=d o x=D)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if foldercounter == 0:
José Chávez
merge revisado
r1074 thispath = os.path.join(path, "%s%04d%03d" %
(prefixDir, year, doy))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
José Chávez
merge revisado
r1074 thispath = os.path.join(path, "%s%04d%03d_%02d" % (
prefixDir, year, doy, foldercounter))
for prefixFile in prefixFileList: # barrido por las dos combinaciones posibles de "D"
# formo el nombre del file xYYYYDDDSSS.ext
filename = "%s%04d%03d%03d%s" % (prefixFile, year, doy, set, ext)
fullfilename = os.path.join(
thispath, filename) # formo el path completo
if os.path.exists(fullfilename): # verifico que exista
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 find_flag = True
break
if find_flag:
break
if not(find_flag):
return None, filename
return fullfilename, filename
José Chávez
merge revisado
r1074
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 def isRadarFolder(folder):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
year = int(folder[1:5])
doy = int(folder[5:8])
except:
return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
merge revisado
r1074
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 def isRadarFile(file):
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112 try:
José Chávez
merge revisado
r1074 year = int(file[1:5])
doy = int(file[5:8])
set = int(file[8:11])
except:
return 0
return 1
add multiSchain (@jchavez)
r892
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589
def getDateFromRadarFile(file):
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112 try:
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 year = int(file[1:5])
doy = int(file[5:8])
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112 set = int(file[8:11])
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 except:
return None
José Chávez
merge revisado
r1074 thisDate = datetime.date(year, 1, 1) + datetime.timedelta(doy - 1)
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 return thisDate
José Chávez
merge revisado
r1074
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 def getDateFromRadarFolder(folder):
try:
year = int(folder[1:5])
doy = int(folder[5:8])
except:
return None
José Chávez
merge revisado
r1074 thisDate = datetime.date(year, 1, 1) + datetime.timedelta(doy - 1)
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 return thisDate
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 class JRODataIO:
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 c = 3E8
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 isConfig = False
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 basicHeaderObj = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 systemHeaderObj = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 radarControllerHeaderObj = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 processingHeaderObj = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 dtype = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 pathList = []
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 filenameList = []
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 filename = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 ext = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 flagIsNewFile = 1
add multiSchain (@jchavez)
r892
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 flagDiscontinuousBlock = 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 flagIsNewBlock = 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fp = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 firstHeaderSize = 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 basicHeaderSize = 24
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 versionFile = 1103
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fileSize = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 # ippSeconds = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fileSizeByHeader = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fileIndex = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 profileIndex = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 blockIndex = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 nTotalBlocks = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 maxTimeStep = 30
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 lastUTTime = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 datablock = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 dataOut = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 blocksize = None
add multiSchain (@jchavez)
r892
Miguel Valdez
JRODATA: timeInterval is a property now...
r527 getByBlock = False
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def __init__(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def run(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 def getDtypeWidth(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 dtype_index = get_dtype_index(self.dtype)
dtype_width = get_dtype_width(dtype_index)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 return dtype_width
add multiSchain (@jchavez)
r892
José Chávez
1.0
r944 def getAllowedArgs(self):
Juan C. Espinoza
Add __attrs__ attribute to Process clasess to improve CLI finder
r1097 if hasattr(self, '__attrs__'):
return self.__attrs__
else:
return inspect.getargspec(self.run).args
José Chávez
1.0
r944
José Chávez
merge revisado
r1074
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 class JRODataReader(JRODataIO):
Juan C. Espinoza
Change multiSchain by MPProject
r1052
Miguel Valdez
realtime argument added to JROReader
r659 online = 0
add multiSchain (@jchavez)
r892
Miguel Valdez
realtime argument added to JROReader
r659 realtime = 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 nReadBlocks = 0
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 delay = 10 # number of seconds waiting a new file
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 nTries = 3 # quantity tries
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 nFiles = 3 # number of files for searching
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 path = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 foldercounter = 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 flagNoMoreFiles = 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 datetimeList = []
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 __isFirstTimeOnline = 1
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 __printInfo = True
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 profileIndex = None
add multiSchain (@jchavez)
r892
Miguel Valdez
Affected:...
r534 nTxs = 1
add multiSchain (@jchavez)
r892
Miguel Valdez
Affected:...
r534 txIndex = None
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # Added--------------------
add multiSchain (@jchavez)
r892
Julio Valdez
New reading option allows to read by blocks of different sizes
r833 selBlocksize = None
add multiSchain (@jchavez)
r892
Julio Valdez
New reading option allows to read by blocks of different sizes
r833 selBlocktime = None
Juan C. Espinoza
Change multiSchain by MPProject
r1052
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def __init__(self):
"""
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 This class is used to find data files
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 Example:
reader = JRODataReader()
fileList = reader.findDataFiles()
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 """
pass
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def createObjByDefault(self):
"""
"""
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def getBlockDimension(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Juan C. Espinoza
Change multiSchain by MPProject
r1052 def searchFilesOffLine(self,
path,
startDate=None,
endDate=None,
José Chávez
merge revisado
r1074 startTime=datetime.time(0, 0, 0),
endTime=datetime.time(23, 59, 59),
Juan C. Espinoza
Change multiSchain by MPProject
r1052 set=None,
expLabel='',
ext='.r',
cursor=None,
skip=None,
walk=True):
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 self.filenameList = []
self.datetimeList = []
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 pathList = []
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 dateList, pathList = self.findDatafiles(
path, startDate, endDate, expLabel, ext, walk, include_path=True)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if dateList == []:
Juan C. Espinoza
Change multiSchain by MPProject
r1052 return [], []
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if len(dateList) > 1:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Data found for date range [%s - %s]: total days = %d" % (startDate, endDate, len(dateList)))
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 else:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Data found for date range [%s - %s]: date = %s" % (startDate, endDate, dateList[0]))
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 filenameList = []
datetimeList = []
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 for thisPath in pathList:
Juan C. Espinoza
Change multiSchain by MPProject
r1052
José Chávez
merge revisado
r1074 fileList = glob.glob1(thisPath, "*%s" % ext)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fileList.sort()
add multiSchain (@jchavez)
r892
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112 for file in fileList:
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 filename = os.path.join(thisPath, file)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if not isFileInDateRange(filename, startDate, endDate):
continue
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 thisDatetime = isFileInTimeRange(
filename, startDate, endDate, startTime, endTime)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(thisDatetime):
continue
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 filenameList.append(filename)
datetimeList.append(thisDatetime)
add multiSchain (@jchavez)
r892
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112 if cursor is not None and skip is not None:
filenameList = filenameList[cursor * skip:cursor * skip + skip]
datetimeList = datetimeList[cursor * skip:cursor * skip + skip]
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(filenameList):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Time range selected invalid [%s - %s]: No *%s files in %s)" % (startTime, endTime, ext, path))
Juan C. Espinoza
Change multiSchain by MPProject
r1052 return [], []
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] %d file(s) was(were) found in time range: %s - %s" % (len(filenameList), startTime, endTime))
add multiSchain (@jchavez)
r892
Juan C. Espinoza
Change multiSchain by MPProject
r1052 # for i in range(len(filenameList)):
# print "[Reading] %s -> [%s]" %(filenameList[i], datetimeList[i].ctime())
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
self.filenameList = filenameList
Juan C. Espinoza
Change multiSchain by MPProject
r1052 self.datetimeList = datetimeList
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return pathList, filenameList
José Chávez
merge revisado
r1074 def __searchFilesOnLine(self, path, expLabel="", ext=None, walk=True, set=None):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
Juan C. Espinoza
Change multiSchain by MPProject
r1052 Busca el ultimo archivo de la ultima carpeta (determinada o no por startDateTime) y
devuelve el archivo encontrado ademas de otros datos.
Input:
path : carpeta donde estan contenidos los files que contiene data
expLabel : Nombre del subexperimento (subfolder)
ext : extension de los files
walk : Si es habilitado no realiza busquedas dentro de los ubdirectorios (doypath)
Return:
directory : eL directorio donde esta el file encontrado
filename : el ultimo file de una determinada carpeta
year : el anho
doy : el numero de dia del anho
set : el set del archivo
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
Miguel Valdez
r700 if not os.path.isdir(path):
return None, None, None, None, None, None
add multiSchain (@jchavez)
r892
Miguel Valdez
r700 dirList = []
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not walk:
fullpath = path
foldercounter = 0
else:
José Chávez
merge revisado
r1074 # Filtra solo los directorios
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for thisPath in os.listdir(path):
José Chávez
merge revisado
r1074 if not os.path.isdir(os.path.join(path, thisPath)):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 continue
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 if not isRadarFolder(thisPath):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 continue
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 dirList.append(thisPath)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(dirList):
return None, None, None, None, None, None
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 dirList = sorted(dirList, key=str.lower)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 doypath = dirList[-1]
José Chávez
merge revisado
r1074 foldercounter = int(doypath.split('_')[1]) if len(
doypath.split('_')) > 1 else 0
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fullpath = os.path.join(path, doypath, expLabel)
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] %s folder was found: " % (fullpath))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
if set == None:
filename = getlastFileFromPath(fullpath, ext)
else:
filename = getFileFromSet(fullpath, ext, set)
if not(filename):
return None, None, None, None, None, None
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] %s file was found" % (filename))
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(self.__verifyFile(os.path.join(fullpath, filename))):
return None, None, None, None, None, None
José Chávez
merge revisado
r1074 year = int(filename[1:5])
doy = int(filename[5:8])
set = int(filename[8:11])
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return fullpath, foldercounter, filename, year, doy, set
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def __setNextFileOffline(self):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 idFile = self.fileIndex
while (True):
idFile += 1
if not(idFile < len(self.filenameList)):
self.flagNoMoreFiles = 1
Juan C. Espinoza
Change multiSchain by MPProject
r1052 # print "[Reading] No more Files"
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 0
filename = self.filenameList[idFile]
if not(self.__verifyFile(filename)):
continue
fileSize = os.path.getsize(filename)
José Chávez
merge revisado
r1074 fp = open(filename, 'rb')
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 break
self.flagIsNewFile = 1
self.fileIndex = idFile
self.filename = filename
self.fileSize = fileSize
self.fp = fp
Juan C. Espinoza
Change multiSchain by MPProject
r1052 # print "[Reading] Setting the file: %s"%self.filename
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
return 1
def __setNextFileOnline(self):
"""
Juan C. Espinoza
Change multiSchain by MPProject
r1052 Busca el siguiente file que tenga suficiente data para ser leida, dentro de un folder especifico, si
no encuentra un file valido espera un tiempo determinado y luego busca en los posibles n files
siguientes.
Affected:
self.flagIsNewFile
self.filename
self.fileSize
self.fp
self.set
self.flagNoMoreFiles
Return:
0 : si luego de una busqueda del siguiente file valido este no pudo ser encontrado
1 : si el file fue abierto con exito y esta listo a ser leido
Excepciones:
Si un determinado file no puede ser abierto
"""
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 nFiles = 0
add multiSchain (@jchavez)
r892 fileOk_flag = False
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 firstTime_flag = True
self.set += 1
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.set > 999:
self.set = 0
add multiSchain (@jchavez)
r892 self.foldercounter += 1
José Chávez
merge revisado
r1074 # busca el 1er file disponible
fullfilename, filename = checkForRealPath(
self.path, self.foldercounter, self.year, self.doy, self.set, self.ext)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if fullfilename:
if self.__verifyFile(fullfilename, False):
fileOk_flag = True
José Chávez
merge revisado
r1074 # si no encuentra un file entonces espera y vuelve a buscar
add multiSchain (@jchavez)
r892 if not(fileOk_flag):
José Chávez
merge revisado
r1074 # busco en los siguientes self.nFiles+1 files posibles
for nFiles in range(self.nFiles + 1):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074 if firstTime_flag: # si es la 1era vez entonces hace el for self.nTries veces
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 tries = self.nTries
else:
José Chávez
merge revisado
r1074 tries = 1 # si no es la 1era vez entonces solo lo hace una vez
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 for nTries in range(tries):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if firstTime_flag:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("\t[Reading] Waiting %0.2f sec for the next file: \"%s\" , try %03d ..." % (self.delay, filename, nTries + 1))
José Chávez
merge revisado
r1074 sleep(self.delay)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("\t[Reading] Searching the next \"%s%04d%03d%03d%s\" file ..." % (self.optchar, self.year, self.doy, self.set, self.ext))
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 fullfilename, filename = checkForRealPath(
self.path, self.foldercounter, self.year, self.doy, self.set, self.ext)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if fullfilename:
if self.__verifyFile(fullfilename):
fileOk_flag = True
break
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if fileOk_flag:
break
firstTime_flag = False
Alarm working ok
r1130 log.warning('Skipping the file {} due to this file doesn\'t exist'.format(filename))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.set += 1
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # si no encuentro el file buscado cambio de carpeta y busco en la siguiente carpeta
if nFiles == (self.nFiles - 1):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.set = 0
self.doy += 1
self.foldercounter = 0
if fileOk_flag:
José Chávez
merge revisado
r1074 self.fileSize = os.path.getsize(fullfilename)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.filename = fullfilename
self.flagIsNewFile = 1
José Chávez
merge revisado
r1074 if self.fp != None:
self.fp.close()
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.fp = open(fullfilename, 'rb')
self.flagNoMoreFiles = 0
Juan C. Espinoza
Change multiSchain by MPProject
r1052 # print '[Reading] Setting the file: %s' % fullfilename
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
self.fileSize = 0
self.filename = None
self.flagIsNewFile = 0
self.fp = None
self.flagNoMoreFiles = 1
return fileOk_flag
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def setNextFile(self):
if self.fp != None:
self.fp.close()
Juan C. Espinoza
Change multiSchain by MPProject
r1052
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.online:
newFile = self.__setNextFileOnline()
else:
newFile = self.__setNextFileOffline()
Juan C. Espinoza
Change multiSchain by MPProject
r1052
Alarm working ok
r1130 if not(newFile):
raise schainpy.admin.SchainWarning('No more files to read')
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 0
José Chávez
finishing day, need testing
r931 if self.verbose:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print('[Reading] Setting the file: %s' % self.filename)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__readFirstHeader()
self.nReadBlocks = 0
return 1
def __waitNewBlock(self):
"""
add multiSchain (@jchavez)
r892 Return 1 si se encontro un nuevo bloque de datos, 0 de otra forma.
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Si el modo de lectura es OffLine siempre retorn 0
"""
if not self.online:
return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if (self.nReadBlocks >= self.processingHeaderObj.dataBlocksPerFile):
return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 currentPointer = self.fp.tell()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 for nTries in range(self.nTries):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.fp.close()
José Chávez
merge revisado
r1074 self.fp = open(self.filename, 'rb')
self.fp.seek(currentPointer)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074 self.fileSize = os.path.getsize(self.filename)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 currentSize = self.fileSize - currentPointer
José Chávez
merge revisado
r1074 if (currentSize >= neededSize):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.basicHeaderObj.read(self.fp)
return 1
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.fileSize == self.fileSizeByHeader:
José Chávez
merge revisado
r1074 # self.flagEoF = True
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 0
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Waiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries + 1))
José Chávez
merge revisado
r1074 sleep(self.delay)
add multiSchain (@jchavez)
r892
return 0
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074 def waitDataBlock(self, pointer_location):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 currentPointer = pointer_location
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 neededSize = self.processingHeaderObj.blockSize # + self.basicHeaderSize
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 for nTries in range(self.nTries):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.fp.close()
José Chávez
merge revisado
r1074 self.fp = open(self.filename, 'rb')
self.fp.seek(currentPointer)
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 self.fileSize = os.path.getsize(self.filename)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 currentSize = self.fileSize - currentPointer
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if (currentSize >= neededSize):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Waiting %0.2f seconds for the next block, try %03d ..." % (self.delay, nTries + 1))
José Chávez
merge revisado
r1074 sleep(self.delay)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 0
def __jumpToLastBlock(self):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(self.__isFirstTimeOnline):
return
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 csize = self.fileSize - self.fp.tell()
blocksize = self.processingHeaderObj.blockSize
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # salta el primer bloque de datos
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if csize > self.processingHeaderObj.blockSize:
self.fp.seek(self.fp.tell() + blocksize)
else:
return
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 csize = self.fileSize - self.fp.tell()
neededsize = self.processingHeaderObj.blockSize + self.basicHeaderSize
while True:
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if self.fp.tell() < self.fileSize:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.fp.seek(self.fp.tell() + neededsize)
else:
self.fp.seek(self.fp.tell() - neededsize)
break
Juan C. Espinoza
Change multiSchain by MPProject
r1052
# csize = self.fileSize - self.fp.tell()
# neededsize = self.processingHeaderObj.blockSize + self.basicHeaderSize
# factor = int(csize/neededsize)
# if factor > 0:
# self.fp.seek(self.fp.tell() + factor*neededsize)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.flagIsNewFile = 0
self.__isFirstTimeOnline = 0
def __setNewBlock(self):
José Chávez
merge revisado
r1074 # if self.server is None:
José Chávez
test zmq for rawdata
r975 if self.fp == None:
return 0
Juan C. Espinoza
Change multiSchain by MPProject
r1052
# if self.online:
José Chávez
merge revisado
r1074 # self.__jumpToLastBlock()
Juan C. Espinoza
Change multiSchain by MPProject
r1052
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.flagIsNewFile:
Miguel Valdez
realtime argument added to JROReader
r659 self.lastUTTime = self.basicHeaderObj.utc
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
add multiSchain (@jchavez)
r892
Miguel Valdez
realtime argument added to JROReader
r659 if self.realtime:
self.flagDiscontinuousBlock = 1
if not(self.setNextFile()):
return 0
else:
José Chávez
merge revisado
r1074 return 1
# if self.server is None:
José Chávez
test zmq for rawdata
r975 currentSize = self.fileSize - self.fp.tell()
neededSize = self.processingHeaderObj.blockSize + self.basicHeaderSize
if (currentSize >= neededSize):
self.basicHeaderObj.read(self.fp)
Miguel Valdez
realtime argument added to JROReader
r659 self.lastUTTime = self.basicHeaderObj.utc
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
test zmq for rawdata
r975 # else:
# self.basicHeaderObj.read(self.zHeader)
# self.lastUTTime = self.basicHeaderObj.utc
# return 1
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.__waitNewBlock():
Miguel Valdez
realtime argument added to JROReader
r659 self.lastUTTime = self.basicHeaderObj.utc
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
José Chávez
merge revisado
r1074 # if self.server is None:
José Chávez
test zmq for rawdata
r975 if not(self.setNextFile()):
return 0
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074 deltaTime = self.basicHeaderObj.utc - self.lastUTTime
Miguel Valdez
realtime argument added to JROReader
r659 self.lastUTTime = self.basicHeaderObj.utc
add multiSchain (@jchavez)
r892
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.flagDiscontinuousBlock = 0
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
if deltaTime > self.maxTimeStep:
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.flagDiscontinuousBlock = 1
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
return 1
def readNextBlock(self):
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # Skip block out of startTime and endTime
while True:
if not(self.__setNewBlock()):
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise schainpy
Miguel Valdez
Filtering block by time
r759 return 0
José Chávez
merge revisado
r1074
Miguel Valdez
Filtering block by time
r759 if not(self.readBlock()):
return 0
Juan C. Espinoza
Change multiSchain by MPProject
r1052
Miguel Valdez
Filtering block by time
r759 self.getBasicHeader()
José Chávez
arreglado varios dias con mp
r1079 if (self.dataOut.datatime < datetime.datetime.combine(self.startDate, self.startTime)) or (self.dataOut.datatime > datetime.datetime.combine(self.endDate, self.endTime)):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Block No. %d/%d -> %s [Skipping]" % (self.nReadBlocks,
José Chávez
merge revisado
r1074 self.processingHeaderObj.dataBlocksPerFile,
George Yong
Python 2to3, Spectra (all operations) working
r1167 self.dataOut.datatime.ctime()))
Miguel Valdez
Filtering block by time
r759 continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 break
add multiSchain (@jchavez)
r892
José Chávez
finishing day, need testing
r931 if self.verbose:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Block No. %d/%d -> %s" % (self.nReadBlocks,
José Chávez
merge revisado
r1074 self.processingHeaderObj.dataBlocksPerFile,
George Yong
Python 2to3, Spectra (all operations) working
r1167 self.dataOut.datatime.ctime()))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
def __readFirstHeader(self):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.basicHeaderObj.read(self.fp)
self.systemHeaderObj.read(self.fp)
self.radarControllerHeaderObj.read(self.fp)
self.processingHeaderObj.read(self.fp)
self.firstHeaderSize = self.basicHeaderObj.size
José Chávez
merge revisado
r1074 datatype = int(numpy.log2((self.processingHeaderObj.processFlags &
PROCFLAG.DATATYPE_MASK)) - numpy.log2(PROCFLAG.DATATYPE_CHAR))
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if datatype == 0:
José Chávez
merge revisado
r1074 datatype_str = numpy.dtype([('real', '<i1'), ('imag', '<i1')])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 elif datatype == 1:
José Chávez
merge revisado
r1074 datatype_str = numpy.dtype([('real', '<i2'), ('imag', '<i2')])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 elif datatype == 2:
José Chávez
merge revisado
r1074 datatype_str = numpy.dtype([('real', '<i4'), ('imag', '<i4')])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 elif datatype == 3:
José Chávez
merge revisado
r1074 datatype_str = numpy.dtype([('real', '<i8'), ('imag', '<i8')])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 elif datatype == 4:
José Chávez
merge revisado
r1074 datatype_str = numpy.dtype([('real', '<f4'), ('imag', '<f4')])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 elif datatype == 5:
José Chávez
merge revisado
r1074 datatype_str = numpy.dtype([('real', '<f8'), ('imag', '<f8')])
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError('Data type was not defined')
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
self.dtype = datatype_str
#self.ippSeconds = 2 * 1000 * self.radarControllerHeaderObj.ipp / self.c
José Chávez
merge revisado
r1074 self.fileSizeByHeader = self.processingHeaderObj.dataBlocksPerFile * self.processingHeaderObj.blockSize + \
self.firstHeaderSize + self.basicHeaderSize * \
(self.processingHeaderObj.dataBlocksPerFile - 1)
José Chávez
arreglado varios dias con mp
r1079 # self.dataOut.channelList = numpy.arange(self.systemHeaderObj.numChannels)
# self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.getBlockDimension()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def __verifyFile(self, filename, msgFlag=True):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 msg = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 try:
fp = open(filename, 'rb')
except IOError:
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if msgFlag:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] File %s can't be opened" % (filename))
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return False
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 currentPosition = fp.tell()
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 neededSize = self.processingHeaderObj.blockSize + self.firstHeaderSize
if neededSize == 0:
basicHeaderObj = BasicHeader(LOCALTIME)
systemHeaderObj = SystemHeader()
radarControllerHeaderObj = RadarControllerHeader()
processingHeaderObj = ProcessingHeader()
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if not(basicHeaderObj.read(fp)):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 fp.close()
return False
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if not(systemHeaderObj.read(fp)):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fp.close()
return False
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if not(radarControllerHeaderObj.read(fp)):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 fp.close()
return False
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if not(processingHeaderObj.read(fp)):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 fp.close()
return False
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 neededSize = processingHeaderObj.blockSize + basicHeaderObj.size
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
José Chávez
merge revisado
r1074 msg = "[Reading] Skipping the file %s due to it hasn't enough data" % filename
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
fp.close()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 fileSize = os.path.getsize(filename)
currentSize = fileSize - currentPosition
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if currentSize < neededSize:
if msgFlag and (msg != None):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print(msg)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return False
return True
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 def findDatafiles(self, path, startDate=None, endDate=None, expLabel='', ext='.r', walk=True, include_path=False):
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 path_empty = True
add multiSchain (@jchavez)
r892
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 dateList = []
pathList = []
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 multi_path = path.split(',')
add multiSchain (@jchavez)
r892
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 if not walk:
add multiSchain (@jchavez)
r892
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 for single_path in multi_path:
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in Signal Chain GUI: Updating FTP configuration from old SendByFTP operation.
r607 if not os.path.isdir(single_path):
continue
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 fileList = glob.glob1(single_path, "*" + ext)
add multiSchain (@jchavez)
r892
Miguel Valdez
Data directories are sorted before reading files
r726 if not fileList:
continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 path_empty = False
add multiSchain (@jchavez)
r892
Miguel Valdez
Data directories are sorted before reading files
r726 fileList.sort()
add multiSchain (@jchavez)
r892
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 for thisFile in fileList:
add multiSchain (@jchavez)
r892
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 if not os.path.isfile(os.path.join(single_path, thisFile)):
continue
add multiSchain (@jchavez)
r892
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 if not isRadarFile(thisFile):
continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if not isFileInDateRange(thisFile, startDate, endDate):
continue
add multiSchain (@jchavez)
r892
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 thisDate = getDateFromRadarFile(thisFile)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if thisDate in dateList:
continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 dateList.append(thisDate)
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 pathList.append(single_path)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 else:
for single_path in multi_path:
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if not os.path.isdir(single_path):
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 dirList = []
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 for thisPath in os.listdir(single_path):
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if not os.path.isdir(os.path.join(single_path, thisPath)):
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if not isRadarFolder(thisPath):
continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if not isFolderInDateRange(thisPath, startDate, endDate):
continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 dirList.append(thisPath)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if not dirList:
continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Data directories are sorted before reading files
r726 dirList.sort()
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in findDataFiles
r601 for thisDir in dirList:
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base:...
r632 datapath = os.path.join(single_path, thisDir, expLabel)
José Chávez
merge revisado
r1074 fileList = glob.glob1(datapath, "*" + ext)
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 if not fileList:
Miguel Valdez
Bug fixed in jroIO_base:...
r632 continue
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 path_empty = False
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 thisDate = getDateFromRadarFolder(thisDir)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base:...
r632 pathList.append(datapath)
Miguel Valdez
-USRP Reader was added to Signal Chain GUI...
r589 dateList.append(thisDate)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 dateList.sort()
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 if walk:
pattern_path = os.path.join(multi_path[0], "[dYYYYDDD]", expLabel)
else:
pattern_path = multi_path[0]
add multiSchain (@jchavez)
r892
Miguel Valdez
Filtering block by time
r759 if path_empty:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] No *%s files in %s for %s to %s" % (ext, pattern_path, startDate, endDate))
Miguel Valdez
Filtering block by time
r759 else:
if not dateList:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Date range selected invalid [%s - %s]: No *%s files in %s)" % (startDate, endDate, ext, path))
Miguel Valdez
Filtering block by time
r759
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 if include_path:
return dateList, pathList
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base: date and time filters were not working when walk=0 and there were many days inside one directory.
r640 return dateList
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def setup(self,
José Chávez
merge revisado
r1074 path=None,
startDate=None,
endDate=None,
startTime=datetime.time(0, 0, 0),
endTime=datetime.time(23, 59, 59),
set=None,
expLabel="",
ext=None,
online=False,
delay=60,
walk=True,
getblock=False,
nTxs=1,
realtime=False,
blocksize=None,
blocktime=None,
skip=None,
cursor=None,
warnings=True,
verbose=True,
server=None,
format=None,
oneDDict=None,
twoDDict=None,
ind2DList=None):
Juan C. Espinoza
Change multiSchain by MPProject
r1052 if server is not None:
if 'tcp://' in server:
address = server
else:
address = 'ipc:///tmp/%s' % server
self.server = address
self.context = zmq.Context()
self.receiver = self.context.socket(zmq.PULL)
self.receiver.connect(self.server)
time.sleep(0.5)
George Yong
Python 2to3, Spectra (all operations) working
r1167 print('[Starting] ReceiverData from {}'.format(self.server))
José Chávez
merge revisado
r1074 else:
Juan C. Espinoza
Change multiSchain by MPProject
r1052 self.server = None
if path == None:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("[Reading] The path is not valid")
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Juan C. Espinoza
Change multiSchain by MPProject
r1052 if ext == None:
ext = self.ext
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Juan C. Espinoza
Change multiSchain by MPProject
r1052 if online:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Searching files in online mode...")
Juan C. Espinoza
Change multiSchain by MPProject
r1052
José Chávez
merge revisado
r1074 for nTries in range(self.nTries):
fullpath, foldercounter, file, year, doy, set = self.__searchFilesOnLine(
path=path, expLabel=expLabel, ext=ext, walk=walk, set=set)
Juan C. Espinoza
Change multiSchain by MPProject
r1052
if fullpath:
break
George Yong
Python 2to3, Spectra (all operations) working
r1167 print('[Reading] Waiting %0.2f sec for an valid file in %s: try %02d ...' % (delay, path, nTries + 1))
Alarm working ok
r1130 sleep(delay)
Juan C. Espinoza
Change multiSchain by MPProject
r1052
Alarm working ok
r1130 if not(fullpath):
raise schainpy.admin.SchainWarning('There isn\'t any valid file in {}'.format(path))
Juan C. Espinoza
Change multiSchain by MPProject
r1052 return
self.year = year
José Chávez
merge revisado
r1074 self.doy = doy
self.set = set - 1
Juan C. Espinoza
Change multiSchain by MPProject
r1052 self.path = path
self.foldercounter = foldercounter
last_set = None
else:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Searching files in offline mode ...")
Juan C. Espinoza
Change multiSchain by MPProject
r1052 pathList, filenameList = self.searchFilesOffLine(path, startDate=startDate, endDate=endDate,
José Chávez
merge revisado
r1074 startTime=startTime, endTime=endTime,
set=set, expLabel=expLabel, ext=ext,
walk=walk, cursor=cursor,
skip=skip)
José Chávez
cambios para online offline
r1019
Juan C. Espinoza
Change multiSchain by MPProject
r1052 if not(pathList):
José Chávez
cambios para online offline
r1019 self.fileIndex = -1
Juan C. Espinoza
Change multiSchain by MPProject
r1052 self.pathList = []
self.filenameList = []
return
Miguel Valdez
sys.exit(-1) was deleted from jroIO_base.py
r676 self.fileIndex = -1
Juan C. Espinoza
Change multiSchain by MPProject
r1052 self.pathList = pathList
self.filenameList = filenameList
file_name = os.path.basename(filenameList[-1])
basename, ext = os.path.splitext(file_name)
last_set = int(basename[-3:])
self.online = online
self.realtime = realtime
self.delay = delay
ext = ext.lower()
self.ext = ext
self.getByBlock = getblock
self.nTxs = nTxs
self.startTime = startTime
self.endTime = endTime
José Chávez
arreglado varios dias con mp
r1079 self.endDate = endDate
self.startDate = startDate
José Chávez
merge revisado
r1074 # Added-----------------
Juan C. Espinoza
Change multiSchain by MPProject
r1052 self.selBlocksize = blocksize
self.selBlocktime = blocktime
# Verbose-----------
self.verbose = verbose
self.warnings = warnings
add multiSchain (@jchavez)
r892
Juan C. Espinoza
Change multiSchain by MPProject
r1052 if not(self.setNextFile()):
José Chávez
merge revisado
r1074 if (startDate != None) and (endDate != None):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] No files in range: %s - %s" % (datetime.datetime.combine(startDate, startTime).ctime(), datetime.datetime.combine(endDate, endTime).ctime()))
Juan C. Espinoza
Change multiSchain by MPProject
r1052 elif startDate != None:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] No files in range: %s" % (datetime.datetime.combine(startDate, startTime).ctime()))
Juan C. Espinoza
Change multiSchain by MPProject
r1052 else:
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] No files")
José Chávez
cambios para online offline
r1019
Juan C. Espinoza
Change multiSchain by MPProject
r1052 self.fileIndex = -1
self.pathList = []
self.filenameList = []
return
# self.getBasicHeader()
José Chávez
cambios para online offline
r1019
Juan C. Espinoza
Change multiSchain by MPProject
r1052 if last_set != None:
José Chávez
merge revisado
r1074 self.dataOut.last_block = last_set * \
self.processingHeaderObj.dataBlocksPerFile + self.basicHeaderObj.dataBlock
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return
def getBasicHeader(self):
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 self.dataOut.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond / \
1000. + self.profileIndex * self.radarControllerHeaderObj.ippSeconds
add multiSchain (@jchavez)
r892
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.dataOut.flagDiscontinuousBlock = self.flagDiscontinuousBlock
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.timeZone = self.basicHeaderObj.timeZone
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.dstFlag = self.basicHeaderObj.dstFlag
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.errorCount = self.basicHeaderObj.errorCount
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut.useLocalTime = self.basicHeaderObj.useLocalTime
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 self.dataOut.ippSeconds = self.radarControllerHeaderObj.ippSeconds / self.nTxs
Juan C. Espinoza
Change multiSchain by MPProject
r1052
# self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock*self.nTxs
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def getFirstHeader(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def getData(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def hasNotDataInBuffer(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def readBlock(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def isEndProcess(self):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return self.flagNoMoreFiles
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def printReadBlocks(self):
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Number of read blocks per file %04d" % self.nReadBlocks)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def printTotalBlocks(self):
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Reading] Number of read blocks %04d" % self.nTotalBlocks)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def printNumberOfBlock(self):
ebocanegra
15/08/2017
r1001 'SPAM!'
add multiSchain (@jchavez)
r892
ebocanegra
15/08/2017
r1001 # if self.flagIsNewBlock:
# print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks,
# self.processingHeaderObj.dataBlocksPerFile,
# self.dataOut.datatime.ctime())
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def printInfo(self):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.__printInfo == False:
return
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.basicHeaderObj.printInfo()
self.systemHeaderObj.printInfo()
self.radarControllerHeaderObj.printInfo()
self.processingHeaderObj.printInfo()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__printInfo = False
add multiSchain (@jchavez)
r892
José Chávez
1.0
r944 def run(self,
José Chávez
merge con online_data_hour
r1039 path=None,
startDate=None,
endDate=None,
José Chávez
merge revisado
r1074 startTime=datetime.time(0, 0, 0),
endTime=datetime.time(23, 59, 59),
José Chávez
merge con online_data_hour
r1039 set=None,
José Chávez
merge revisado
r1074 expLabel="",
ext=None,
online=False,
delay=60,
walk=True,
getblock=False,
nTxs=1,
José Chávez
merge con online_data_hour
r1039 realtime=False,
blocksize=None,
blocktime=None,
skip=None,
cursor=None,
warnings=True,
server=None,
José Chávez
merge revisado
r1074 verbose=True,
format=None,
oneDDict=None,
twoDDict=None,
ind2DList=None, **kwargs):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(self.isConfig):
Juan C. Espinoza
Change multiSchain by MPProject
r1052 self.setup(path=path,
startDate=startDate,
endDate=endDate,
startTime=startTime,
endTime=endTime,
set=set,
expLabel=expLabel,
ext=ext,
online=online,
delay=delay,
walk=walk,
getblock=getblock,
nTxs=nTxs,
realtime=realtime,
blocksize=blocksize,
blocktime=blocktime,
skip=skip,
cursor=cursor,
warnings=warnings,
server=server,
MADReader support for HDF5 (mad2 & mad3)
r1065 verbose=verbose,
format=format,
oneDDict=oneDDict,
twoDDict=twoDDict,
ind2DList=ind2DList)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.isConfig = True
José Chávez
test zmq for rawdata
r975 if server is None:
self.getData()
José Chávez
merge revisado
r1074 else:
José Chávez
test zmq for rawdata
r975 self.getFromServer()
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 class JRODataWriter(JRODataIO):
add multiSchain (@jchavez)
r892 """
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Esta clase permite escribir datos a archivos procesados (.r o ,pdata). La escritura
add multiSchain (@jchavez)
r892 de los datos siempre se realiza por bloques.
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 blockIndex = 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 path = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 setFile = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 profilesPerBlock = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 blocksPerFile = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 nWriteBlocks = 0
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base:...
r632 fileDate = None
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def __init__(self, dataOut=None):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def hasAllDataInBuffer(self):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def setBlockDimension(self):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def writeBlock(self):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def putData(self):
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 def getProcessFlags(self):
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 processFlags = 0
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 dtype_index = get_dtype_index(self.dtype)
procflag_dtype = get_procflag_dtype(dtype_index)
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 processFlags += procflag_dtype
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if self.dataOut.flagDecodeData:
processFlags += PROCFLAG.DECODE_DATA
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if self.dataOut.flagDeflipData:
processFlags += PROCFLAG.DEFLIP_DATA
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if self.dataOut.code is not None:
processFlags += PROCFLAG.DEFINE_PROCESS_CODE
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if self.dataOut.nCohInt > 1:
processFlags += PROCFLAG.COHERENT_INTEGRATION
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if self.dataOut.type == "Spectra":
if self.dataOut.nIncohInt > 1:
processFlags += PROCFLAG.INCOHERENT_INTEGRATION
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if self.dataOut.data_dc is not None:
processFlags += PROCFLAG.SAVE_CHANNELS_DC
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed:...
r624 if self.dataOut.flagShiftFFT:
processFlags += PROCFLAG.SHIFT_FFT_DATA
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 return processFlags
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def setBasicHeader(self):
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 self.basicHeaderObj.size = self.basicHeaderSize # bytes
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.basicHeaderObj.version = self.versionFile
Miguel Valdez
Bug fixed in jroIO_base:...
r632 self.basicHeaderObj.dataBlock = self.nTotalBlocks
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 utc = numpy.floor(self.dataOut.utctime)
José Chávez
merge revisado
r1074 milisecond = (self.dataOut.utctime - utc) * 1000.0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.basicHeaderObj.utc = utc
self.basicHeaderObj.miliSecond = milisecond
self.basicHeaderObj.timeZone = self.dataOut.timeZone
self.basicHeaderObj.dstFlag = self.dataOut.dstFlag
self.basicHeaderObj.errorCount = self.dataOut.errorCount
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def setFirstHeader(self):
"""
Obtiene una copia del First Header
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Affected:
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.basicHeaderObj
self.systemHeaderObj
self.radarControllerHeaderObj
self.processingHeaderObj self.
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
None
"""
add multiSchain (@jchavez)
r892
Miguel Valdez
-Using ValueError raises instead of IOError...
r684 raise NotImplementedError
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def __writeFirstHeader(self):
"""
Escribe el primer header del file es decir el Basic header y el Long header (SystemHeader, RadarControllerHeader, ProcessingHeader)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Affected:
__dataType
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
None
"""
Juan C. Espinoza
Change multiSchain by MPProject
r1052
# CALCULAR PARAMETROS
José Chávez
merge revisado
r1074 sizeLongHeader = self.systemHeaderObj.size + \
self.radarControllerHeaderObj.size + self.processingHeaderObj.size
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.basicHeaderObj.size = self.basicHeaderSize + sizeLongHeader
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.basicHeaderObj.write(self.fp)
self.systemHeaderObj.write(self.fp)
self.radarControllerHeaderObj.write(self.fp)
self.processingHeaderObj.write(self.fp)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def __setNewBlock(self):
"""
Si es un nuevo file escribe el First Header caso contrario escribe solo el Basic Header
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
0 : si no pudo escribir nada
1 : Si escribio el Basic el First Header
add multiSchain (@jchavez)
r892 """
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.fp == None:
self.setNextFile()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.flagIsNewFile:
return 1
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.blockIndex < self.processingHeaderObj.dataBlocksPerFile:
self.basicHeaderObj.write(self.fp)
return 1
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if not(self.setNextFile()):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
def writeNextBlock(self):
"""
Selecciona el bloque siguiente de datos y los escribe en un file
add multiSchain (@jchavez)
r892
Return:
0 : Si no hizo pudo escribir el bloque de datos
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 1 : Si no pudo escribir el bloque de datos
"""
José Chávez
merge revisado
r1074 if not(self.__setNewBlock()):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.writeBlock()
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Writing] Block No. %d/%d" % (self.blockIndex,
self.processingHeaderObj.dataBlocksPerFile))
add multiSchain (@jchavez)
r892
return 1
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
def setNextFile(self):
add multiSchain (@jchavez)
r892 """
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Determina el siguiente file que sera escrito
add multiSchain (@jchavez)
r892 Affected:
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.filename
self.subfolder
self.fp
self.setFile
self.flagIsNewFile
Return:
0 : Si el archivo no puede ser escrito
1 : Si el archivo esta listo para ser escrito
"""
ext = self.ext
path = self.path
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if self.fp != None:
self.fp.close()
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 timeTuple = time.localtime(self.dataOut.utctime)
subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year, timeTuple.tm_yday)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074 fullpath = os.path.join(path, subfolder)
Miguel Valdez
Bug fixed in jroIO_base:...
r632 setFile = self.setFile
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 if not(os.path.exists(fullpath)):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 os.mkdir(fullpath)
José Chávez
merge revisado
r1074 setFile = -1 # inicializo mi contador de seteo
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
José Chávez
merge revisado
r1074 filesList = os.listdir(fullpath)
if len(filesList) > 0:
filesList = sorted(filesList, key=str.lower)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 filen = filesList[-1]
# el filename debera tener el siguiente formato
# 0 1234 567 89A BCDE (hex)
# x YYYY DDD SSS .ext
José Chávez
merge revisado
r1074 if isNumber(filen[8:11]):
# inicializo mi contador de seteo al seteo del ultimo file
setFile = int(filen[8:11])
add multiSchain (@jchavez)
r892 else:
Miguel Valdez
Bug fixed in jroIO_base:...
r632 setFile = -1
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 else:
José Chávez
merge revisado
r1074 setFile = -1 # inicializo mi contador de seteo
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 setFile += 1
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # If this is a new day it resets some values
Miguel Valdez
Bug fixed in jroIO_base:...
r632 if self.dataOut.datatime.date() > self.fileDate:
setFile = 0
self.nTotalBlocks = 0
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112
filen = '{}{:04d}{:03d}{:03d}{}'.format(
self.optchar, timeTuple.tm_year, timeTuple.tm_yday, setFile, ext)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074 filename = os.path.join(path, subfolder, filen)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
José Chávez
merge revisado
r1074 fp = open(filename, 'wb')
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.blockIndex = 0
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 # guardando atributos
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.filename = filename
self.subfolder = subfolder
self.fp = fp
self.setFile = setFile
self.flagIsNewFile = 1
Miguel Valdez
Bug fixed in jroIO_base:...
r632 self.fileDate = self.dataOut.datatime.date()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.setFirstHeader()
add multiSchain (@jchavez)
r892
George Yong
Python 2to3, Spectra (all operations) working
r1167 print('[Writing] Opening file: %s' % self.filename)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.__writeFirstHeader()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
add multiSchain (@jchavez)
r892
Juan C. Espinoza
Change multiSchain by MPProject
r1052 def setup(self, dataOut, path, blocksPerFile, profilesPerBlock=64, set=None, ext=None, datatype=4):
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
add multiSchain (@jchavez)
r892 Setea el tipo de formato en la cual sera guardada la data y escribe el First Header
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Inputs:
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 path : directory where data will be saved
add multiSchain (@jchavez)
r892 profilesPerBlock : number of profiles per block
Miguel Valdez
IO_Writer: default datatype was changed to 3 (int32), instead of 2 (int16).
r626 set : initial file set
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 datatype : An integer number that defines data type:
0 : int8 (1 byte)
1 : int16 (2 bytes)
2 : int32 (4 bytes)
3 : int64 (8 bytes)
Miguel Valdez
IO_Writer: default datatype was changed to 3 (int32), instead of 2 (int16).
r626 4 : float32 (4 bytes)
5 : double64 (8 bytes)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Return:
0 : Si no realizo un buen seteo
add multiSchain (@jchavez)
r892 1 : Si realizo un buen seteo
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if ext == None:
ext = self.ext
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed in jroIO_base:...
r632 self.ext = ext.lower()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.path = path
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112
Miguel Valdez
Bug fixed in jroIO_base:...
r632 if set is None:
self.setFile = -1
else:
Juan C. Espinoza
set new matplotlib version in setup, improved searchFiles for multiprocessing
r1112 self.setFile = set - 1
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.blocksPerFile = blocksPerFile
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.profilesPerBlock = profilesPerBlock
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.dataOut = dataOut
Miguel Valdez
Bug fixed in jroIO_base:...
r632 self.fileDate = self.dataOut.datatime.date()
José Chávez
merge revisado
r1074 # By default
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 self.dtype = self.dataOut.dtype
add multiSchain (@jchavez)
r892
Miguel Valdez
Bug fixed: error calculating size of RC Header. ...
r616 if datatype is not None:
self.dtype = get_numpy_dtype(datatype)
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(self.setNextFile()):
George Yong
Python 2to3, Spectra (all operations) working
r1167 print("[Writing] There isn't a next file")
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 0
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.setBlockDimension()
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 return 1
add multiSchain (@jchavez)
r892
José Chávez
1.0
r944 def run(self, dataOut, path, blocksPerFile, profilesPerBlock=64, set=None, ext=None, datatype=4, **kwargs):
add multiSchain (@jchavez)
r892
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not(self.isConfig):
add multiSchain (@jchavez)
r892
José Chávez
merge revisado
r1074 self.setup(dataOut, path, blocksPerFile, profilesPerBlock=profilesPerBlock,
set=set, ext=ext, datatype=datatype, **kwargs)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.isConfig = True
George Yong
Python 2to3, Spectra (all operations) working
r1167 self.putData()