@@ -483,9 +483,25 class Spectra(JROData): | |||
|
483 | 483 | |
|
484 | 484 | return normFactor |
|
485 | 485 | |
|
486 | def getFlagCspc(self): | |
|
487 | ||
|
488 | if self.data_cspc == None: | |
|
489 | return True | |
|
490 | ||
|
491 | return False | |
|
492 | ||
|
493 | def getFlagDc(self): | |
|
494 | ||
|
495 | if self.data_dc == None: | |
|
496 | return True | |
|
497 | ||
|
498 | return False | |
|
499 | ||
|
486 | 500 | nPairs = property(getNPairs, "I'm the 'nPairs' property.") |
|
487 | 501 | pairsIndexList = property(getPairsIndexList, "I'm the 'pairsIndexList' property.") |
|
488 | 502 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") |
|
503 | flag_cspc = property(getFlagCspc) | |
|
504 | flag_dc = property(getFlagDc) | |
|
489 | 505 | |
|
490 | 506 | class SpectraHeis(JROData): |
|
491 | 507 |
@@ -1965,7 +1965,8 class SpectraReader(JRODataReader): | |||
|
1965 | 1965 | if self.processingHeaderObj.flag_cspc: |
|
1966 | 1966 | #desplaza a la derecha en el eje 2 determinadas posiciones |
|
1967 | 1967 | cspc = numpy.roll( cspc, shift, axis=2 ) |
|
1968 | ||
|
1968 | ||
|
1969 | self.processingHeaderObj.shif_fft = True | |
|
1969 | 1970 | |
|
1970 | 1971 | spc = numpy.transpose( spc, (0,2,1) ) |
|
1971 | 1972 | self.data_spc = spc |
@@ -829,7 +829,128 class SpectraProc(ProcessingUnit): | |||
|
829 | 829 | |
|
830 | 830 | return 1 |
|
831 | 831 | |
|
832 | def selectHeights(self, minHei, maxHei): | |
|
833 | """ | |
|
834 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango | |
|
835 | minHei <= height <= maxHei | |
|
836 | ||
|
837 | Input: | |
|
838 | minHei : valor minimo de altura a considerar | |
|
839 | maxHei : valor maximo de altura a considerar | |
|
840 | ||
|
841 | Affected: | |
|
842 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex | |
|
843 | ||
|
844 | Return: | |
|
845 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
|
846 | """ | |
|
847 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): | |
|
848 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
849 | ||
|
850 | if (maxHei > self.dataOut.heightList[-1]): | |
|
851 | maxHei = self.dataOut.heightList[-1] | |
|
852 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
853 | ||
|
854 | minIndex = 0 | |
|
855 | maxIndex = 0 | |
|
856 | heights = self.dataOut.heightList | |
|
857 | ||
|
858 | inda = numpy.where(heights >= minHei) | |
|
859 | indb = numpy.where(heights <= maxHei) | |
|
860 | ||
|
861 | try: | |
|
862 | minIndex = inda[0][0] | |
|
863 | except: | |
|
864 | minIndex = 0 | |
|
865 | ||
|
866 | try: | |
|
867 | maxIndex = indb[0][-1] | |
|
868 | except: | |
|
869 | maxIndex = len(heights) | |
|
870 | ||
|
871 | self.selectHeightsByIndex(minIndex, maxIndex) | |
|
872 | ||
|
873 | return 1 | |
|
874 | ||
|
875 | ||
|
876 | def selectHeightsByIndex(self, minIndex, maxIndex): | |
|
877 | """ | |
|
878 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango | |
|
879 | minIndex <= index <= maxIndex | |
|
880 | ||
|
881 | Input: | |
|
882 | minIndex : valor de indice minimo de altura a considerar | |
|
883 | maxIndex : valor de indice maximo de altura a considerar | |
|
884 | ||
|
885 | Affected: | |
|
886 | self.dataOut.data_spc | |
|
887 | self.dataOut.data_cspc | |
|
888 | self.dataOut.data_dc | |
|
889 | self.dataOut.heightList | |
|
890 | ||
|
891 | Return: | |
|
892 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
|
893 | """ | |
|
894 | ||
|
895 | if (minIndex < 0) or (minIndex > maxIndex): | |
|
896 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
|
897 | ||
|
898 | if (maxIndex >= self.dataOut.nHeights): | |
|
899 | maxIndex = self.dataOut.nHeights-1 | |
|
900 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
|
901 | ||
|
902 | nHeights = maxIndex - minIndex + 1 | |
|
832 | 903 | |
|
904 | #Spectra | |
|
905 | data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1] | |
|
906 | ||
|
907 | data_cspc = None | |
|
908 | if self.dataOut.data_cspc != None: | |
|
909 | data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1] | |
|
910 | ||
|
911 | data_dc = None | |
|
912 | if self.dataOut.data_dc != None: | |
|
913 | data_dc = self.dataOut.data_dc[:,:,minIndex:maxIndex+1] | |
|
914 | ||
|
915 | self.dataOut.data_spc = data_spc | |
|
916 | self.dataOut.data_cspc = data_cspc | |
|
917 | self.dataOut.data_dc = data_dc | |
|
918 | ||
|
919 | self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1] | |
|
920 | ||
|
921 | return 1 | |
|
922 | ||
|
923 | def removeDC(self, mode = 1): | |
|
924 | ||
|
925 | dc_index = 0 | |
|
926 | freq_index = numpy.array([-2,-1,1,2]) | |
|
927 | data_spc = self.dataOut.data_spc | |
|
928 | data_cspc = self.dataOut.data_cspc | |
|
929 | data_dc = self.dataOut.data_dc | |
|
930 | ||
|
931 | if self.dataOut.flagShiftFFT: | |
|
932 | dc_index += self.dataOut.nFFTPoints/2 | |
|
933 | freq_index += self.dataOut.nFFTPoints/2 | |
|
934 | ||
|
935 | if mode == 1: | |
|
936 | data_spc[dc_index] = (data_spc[:,freq_index[1],:] + data_spc[:,freq_index[2],:])/2 | |
|
937 | if data_cspc != None: | |
|
938 | data_cspc[dc_index] = (data_cspc[:,freq_index[1],:] + data_cspc[:,freq_index[2],:])/2 | |
|
939 | return 1 | |
|
940 | ||
|
941 | if mode == 2: | |
|
942 | pass | |
|
943 | ||
|
944 | if mode == 3: | |
|
945 | pass | |
|
946 | ||
|
947 | raise ValueError, "mode parameter has to be 1, 2 or 3" | |
|
948 | ||
|
949 | def removeInterference(self): | |
|
950 | ||
|
951 | pass | |
|
952 | ||
|
953 | ||
|
833 | 954 | class IncohInt(Operation): |
|
834 | 955 | |
|
835 | 956 |
General Comments 0
You need to be logged in to leave comments.
Login now