@@ -12,6 +12,7 import itertools | |||||
12 | from multiprocessing import Pool, TimeoutError |
|
12 | from multiprocessing import Pool, TimeoutError | |
13 | from multiprocessing.pool import ThreadPool |
|
13 | from multiprocessing.pool import ThreadPool | |
14 | import time |
|
14 | import time | |
|
15 | ||||
15 | from scipy.optimize import fmin_l_bfgs_b #optimize with bounds on state papameters |
|
16 | from scipy.optimize import fmin_l_bfgs_b #optimize with bounds on state papameters | |
16 | from .jroproc_base import ProcessingUnit, Operation, MPDecorator |
|
17 | from .jroproc_base import ProcessingUnit, Operation, MPDecorator | |
17 | from schainpy.model.data.jrodata import Parameters, hildebrand_sekhon |
|
18 | from schainpy.model.data.jrodata import Parameters, hildebrand_sekhon | |
@@ -328,8 +329,6 class GaussianFit(Operation): | |||||
328 | Operation.__init__(self) |
|
329 | Operation.__init__(self) | |
329 | self.i=0 |
|
330 | self.i=0 | |
330 |
|
331 | |||
331 |
|
||||
332 | # def run(self, dataOut, num_intg=7, pnoise=1., SNRlimit=-9): #num_intg: Incoherent integrations, pnoise: Noise, vel_arr: range of velocities, similar to the ftt points |
|
|||
333 | def run(self, dataOut, SNRdBlimit=-9, method='generalized'): |
|
332 | def run(self, dataOut, SNRdBlimit=-9, method='generalized'): | |
334 | """This routine will find a couple of generalized Gaussians to a power spectrum |
|
333 | """This routine will find a couple of generalized Gaussians to a power spectrum | |
335 | methods: generalized, squared |
|
334 | methods: generalized, squared | |
@@ -715,6 +714,7 class Oblique_Gauss_Fit(Operation): | |||||
715 |
|
714 | |||
716 | return gaussian(x, popt[0], popt[1], popt[2], popt[3]), popt[0], popt[1], popt[2], popt[3] |
|
715 | return gaussian(x, popt[0], popt[1], popt[2], popt[3]), popt[0], popt[1], popt[2], popt[3] | |
717 |
|
716 | |||
|
717 | ||||
718 | def Gauss_fit_2(self,spc,x,nGauss): |
|
718 | def Gauss_fit_2(self,spc,x,nGauss): | |
719 |
|
719 | |||
720 |
|
720 | |||
@@ -2979,34 +2979,44 class JULIADriftsEstimation(Operation): | |||||
2979 |
|
2979 | |||
2980 | def run(self, dataOut, zenith, zenithCorrection,heights=None, statistics=0, otype=0): |
|
2980 | def run(self, dataOut, zenith, zenithCorrection,heights=None, statistics=0, otype=0): | |
2981 |
|
2981 | |||
|
2982 | dataOut.lat=-11.95 | |||
|
2983 | dataOut.lon=-76.87 | |||
2982 | nCh=dataOut.spcpar.shape[0] |
|
2984 | nCh=dataOut.spcpar.shape[0] | |
2983 | nHei=dataOut.spcpar.shape[1] |
|
2985 | nHei=dataOut.spcpar.shape[1] | |
2984 | nParam=dataOut.spcpar.shape[2] |
|
2986 | nParam=dataOut.spcpar.shape[2] | |
2985 |
# S |
|
2987 | # SelecciΓ³n de alturas | |
2986 | hei=dataOut.heightList |
|
2988 | ||
2987 | hvalid=numpy.where([hei >= heights[0]][0] & [hei <= heights[1]][0])[0] |
|
2989 | if not heights: | |
2988 | nhvalid=len(hvalid) |
|
2990 | parm = numpy.zeros((nCh,nHei,nParam)) | |
2989 | parm = numpy.zeros((nCh,nhvalid,nParam)) |
|
2991 | parm[:] = dataOut.spcpar[:] | |
2990 | parm = dataOut.spcpar[:,hvalid,:] |
|
2992 | else: | |
|
2993 | hei=dataOut.heightList | |||
|
2994 | hvalid=numpy.where([hei >= heights[0]][0] & [hei <= heights[1]][0])[0] | |||
|
2995 | nhvalid=len(hvalid) | |||
|
2996 | dataOut.heightList = hei[hvalid] | |||
|
2997 | parm = numpy.zeros((nCh,nhvalid,nParam)) | |||
|
2998 | parm[:] = dataOut.spcpar[:,hvalid,:] | |||
|
2999 | ||||
|
3000 | ||||
2991 | # Primer filtrado: Umbral de SNR |
|
3001 | # Primer filtrado: Umbral de SNR | |
2992 | for i in range(nCh): |
|
3002 | for i in range(nCh): | |
2993 |
|
|
3003 | parm[i,:,:] = self.data_filter(parm[i,:,:])[0] | |
|
3004 | ||||
2994 | zenith = numpy.array(zenith) |
|
3005 | zenith = numpy.array(zenith) | |
2995 | zenith -= zenithCorrection |
|
3006 | zenith -= zenithCorrection | |
2996 | zenith *= numpy.pi/180 |
|
3007 | zenith *= numpy.pi/180 | |
2997 | alpha = zenith[0] |
|
3008 | alpha = zenith[0] | |
2998 | beta = zenith[1] |
|
3009 | beta = zenith[1] | |
2999 |
|
3010 | dopplerCH0 = parm[0,:,0] | ||
3000 |
dopplerCH |
|
3011 | dopplerCH1 = parm[1,:,0] | |
3001 |
|
|
3012 | swCH0 = parm[0,:,1] | |
3002 |
swCH |
|
3013 | swCH1 = parm[1,:,1] | |
3003 |
s |
|
3014 | snrCH0 = 10*numpy.log10(parm[0,:,2]) | |
3004 |
snrCH |
|
3015 | snrCH1 = 10*numpy.log10(parm[1,:,2]) | |
3005 | snrCH1 = 10*numpy.log10(dataOut.spcpar[1,:,2]) |
|
3016 | noiseCH0 = parm[0,:,3] | |
3006 |
noiseCH |
|
3017 | noiseCH1 = parm[1,:,3] | |
3007 |
|
|
3018 | wErrCH0 = parm[0,:,5] | |
3008 |
wErrCH |
|
3019 | wErrCH1 = parm[1,:,5] | |
3009 | wErrCH1 = dataOut.spcpar[1,:,5] |
|
|||
3010 |
|
3020 | |||
3011 | # Vertical and zonal calculation according to geometry |
|
3021 | # Vertical and zonal calculation according to geometry | |
3012 | sinB_A = numpy.sin(beta)*numpy.cos(alpha) - numpy.sin(alpha)* numpy.cos(beta) |
|
3022 | sinB_A = numpy.sin(beta)*numpy.cos(alpha) - numpy.sin(alpha)* numpy.cos(beta) | |
@@ -3020,7 +3030,8 class JULIADriftsEstimation(Operation): | |||||
3020 |
|
3030 | |||
3021 | # for statistics150km |
|
3031 | # for statistics150km | |
3022 | if statistics: |
|
3032 | if statistics: | |
3023 |
print('Implemented offline.') |
|
3033 | print('Implemented offline.') | |
|
3034 | ||||
3024 | if otype == 0: |
|
3035 | if otype == 0: | |
3025 | winds = numpy.vstack((snr, drift, zonal, noise, sw, w_w_err, w_e_err)) # to process statistics drifts |
|
3036 | winds = numpy.vstack((snr, drift, zonal, noise, sw, w_w_err, w_e_err)) # to process statistics drifts | |
3026 | elif otype == 3: |
|
3037 | elif otype == 3: | |
@@ -3034,6 +3045,10 class JULIADriftsEstimation(Operation): | |||||
3034 |
|
3045 | |||
3035 | dataOut.utctimeInit = dataOut.utctime |
|
3046 | dataOut.utctimeInit = dataOut.utctime | |
3036 | dataOut.outputInterval = dataOut.timeInterval |
|
3047 | dataOut.outputInterval = dataOut.timeInterval | |
|
3048 | try: | |||
|
3049 | dataOut.flagNoData = numpy.all(numpy.isnan(dataOut.data_output[0])) # NAN vectors are not written MADRIGAL CASE | |||
|
3050 | except: | |||
|
3051 | print("Check there is no Data") | |||
3037 |
|
3052 | |||
3038 | return dataOut |
|
3053 | return dataOut | |
3039 |
|
3054 |
General Comments 0
You need to be logged in to leave comments.
Login now