@@ -1012,26 +1012,32 class CoherenceMap(Figure): | |||
|
1012 | 1012 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
1013 | 1013 | self.__isConfig = False |
|
1014 | 1014 | |
|
1015 |
class |
|
|
1015 | class Noise(Figure): | |
|
1016 | 1016 | |
|
1017 | 1017 | __isConfig = None |
|
1018 | 1018 | __nsubplots = None |
|
1019 | 1019 | |
|
1020 |
PREFIX = ' |
|
|
1020 | PREFIX = 'noise' | |
|
1021 | 1021 | |
|
1022 | 1022 | def __init__(self): |
|
1023 | 1023 | |
|
1024 | 1024 | self.timerange = 24*60*60 |
|
1025 | 1025 | self.__isConfig = False |
|
1026 | 1026 | self.__nsubplots = 1 |
|
1027 | ||
|
1028 |
self.WIDTH = |
|
|
1029 |
self.HEIGHT = |
|
|
1027 | self.counter_imagwr = 0 | |
|
1028 | self.WIDTH = 600 | |
|
1029 | self.HEIGHT = 300 | |
|
1030 | 1030 | self.WIDTHPROF = 120 |
|
1031 | 1031 | self.HEIGHTPROF = 0 |
|
1032 | 1032 | self.xdata = None |
|
1033 | 1033 | self.ydata = None |
|
1034 | 1034 | |
|
1035 | self.PLOT_CODE = 77 | |
|
1036 | self.FTP_WEI = None | |
|
1037 | self.EXP_CODE = None | |
|
1038 | self.SUB_EXP_CODE = None | |
|
1039 | self.PLOT_POS = None | |
|
1040 | ||
|
1035 | 1041 | def getSubplots(self): |
|
1036 | 1042 | |
|
1037 | 1043 | ncol = 1 |
@@ -1062,7 +1068,9 class RTIfromNoise(Figure): | |||
|
1062 | 1068 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True', |
|
1063 | 1069 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1064 | 1070 | timerange=None, |
|
1065 |
save=False, figpath='./', figfile=None, show=True |
|
|
1071 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, | |
|
1072 | server=None, folder=None, username=None, password=None, | |
|
1073 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): | |
|
1066 | 1074 | |
|
1067 | 1075 | if channelList == None: |
|
1068 | 1076 | channelIndexList = dataOut.channelIndexList |
@@ -1087,9 +1095,9 class RTIfromNoise(Figure): | |||
|
1087 | 1095 | |
|
1088 | 1096 | #thisDatetime = dataOut.datatime |
|
1089 | 1097 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) |
|
1090 |
title = wintitle + " |
|
|
1098 | title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) | |
|
1091 | 1099 | xlabel = "" |
|
1092 |
ylabel = " |
|
|
1100 | ylabel = "Intensity (dB)" | |
|
1093 | 1101 | |
|
1094 | 1102 | if not self.__isConfig: |
|
1095 | 1103 | |
@@ -1102,8 +1110,16 class RTIfromNoise(Figure): | |||
|
1102 | 1110 | show=show) |
|
1103 | 1111 | |
|
1104 | 1112 | tmin, tmax = self.getTimeLim(x, xmin, xmax) |
|
1105 | if ymin == None: ymin = numpy.nanmin(noisedB) | |
|
1106 | if ymax == None: ymax = numpy.nanmax(noisedB) | |
|
1113 | if ymin == None: ymin = numpy.nanmin(noisedB) - 10.0 | |
|
1114 | if ymax == None: ymax = numpy.nanmax(noisedB) + 10.0 | |
|
1115 | ||
|
1116 | self.FTP_WEI = ftp_wei | |
|
1117 | self.EXP_CODE = exp_code | |
|
1118 | self.SUB_EXP_CODE = sub_exp_code | |
|
1119 | self.PLOT_POS = plot_pos | |
|
1120 | ||
|
1121 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
|
1122 | ||
|
1107 | 1123 | |
|
1108 | 1124 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1109 | 1125 | self.__isConfig = True |
@@ -1114,9 +1130,9 class RTIfromNoise(Figure): | |||
|
1114 | 1130 | self.setWinTitle(title) |
|
1115 | 1131 | |
|
1116 | 1132 | |
|
1117 |
title = " |
|
|
1133 | title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) | |
|
1118 | 1134 | |
|
1119 | legendlabels = ["channel %d"%idchannel for idchannel in channelList] | |
|
1135 | legendlabels = ["channel %d"%(idchannel+1) for idchannel in channelList] | |
|
1120 | 1136 | axes = self.axesList[0] |
|
1121 | 1137 | |
|
1122 | 1138 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
@@ -1130,18 +1146,40 class RTIfromNoise(Figure): | |||
|
1130 | 1146 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1131 | 1147 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, |
|
1132 | 1148 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1133 | XAxisAsTime=True | |
|
1149 | XAxisAsTime=True, grid='both' | |
|
1134 | 1150 | ) |
|
1135 | 1151 | |
|
1136 | 1152 | self.draw() |
|
1137 | 1153 | |
|
1154 | # if save: | |
|
1155 | # | |
|
1156 | # if figfile == None: | |
|
1157 | # figfile = self.getFilename(name = self.name) | |
|
1158 | # | |
|
1159 | # self.saveFigure(figpath, figfile) | |
|
1160 | ||
|
1138 | 1161 | if save: |
|
1139 | 1162 | |
|
1163 | self.counter_imagwr += 1 | |
|
1164 | if (self.counter_imagwr==wr_period): | |
|
1140 | 1165 | if figfile == None: |
|
1141 | 1166 | figfile = self.getFilename(name = self.name) |
|
1142 | ||
|
1143 | 1167 | self.saveFigure(figpath, figfile) |
|
1144 | 1168 | |
|
1169 | if ftp: | |
|
1170 | #provisionalmente envia archivos en el formato de la web en tiempo real | |
|
1171 | name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS) | |
|
1172 | path = '%s%03d' %(self.PREFIX, self.id) | |
|
1173 | ftp_file = os.path.join(path,'ftp','%s.png'%name) | |
|
1174 | self.saveFigure(figpath, ftp_file) | |
|
1175 | ftp_filename = os.path.join(figpath,ftp_file) | |
|
1176 | try: | |
|
1177 | self.sendByFTP(ftp_filename, server, folder, username, password) | |
|
1178 | except: | |
|
1179 | raise ValueError, 'Error FTP' | |
|
1180 | ||
|
1181 | self.counter_imagwr = 0 | |
|
1182 | ||
|
1145 | 1183 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
1146 | 1184 | self.__isConfig = False |
|
1147 | 1185 | del self.xdata |
General Comments 0
You need to be logged in to leave comments.
Login now