##// END OF EJS Templates
Parameters libraries reorganized, now each operation is a separated class
Julio Valdez -
r841:c38d03dda608
parent child
Show More
@@ -366,7 +366,7 class WindProfilerPlot(Figure):
366 366 self.__nsubplots = 1
367 367
368 368 self.WIDTH = 800
369 self.HEIGHT = 150
369 self.HEIGHT = 300
370 370 self.WIDTHPROF = 120
371 371 self.HEIGHTPROF = 0
372 372 self.counter_imagwr = 0
@@ -474,7 +474,7 class WindProfilerPlot(Figure):
474 474 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime)
475 475 title = wintitle + "Wind"
476 476 xlabel = ""
477 ylabel = "Range (Km)"
477 ylabel = "Height (km)"
478 478 update_figfile = False
479 479
480 480 if not self.isConfig:
@@ -669,7 +669,7 class ParametersPlot(Figure):
669 669 return
670 670
671 671 if channelList == None:
672 channelIndexList = dataOut.channelIndexList
672 channelIndexList = range(dataOut.data_param.shape[0])
673 673 else:
674 674 channelIndexList = []
675 675 for channel in channelList:
@@ -679,8 +679,12 class ParametersPlot(Figure):
679 679
680 680 x = dataOut.getTimeRange1(dataOut.paramInterval)
681 681 y = dataOut.getHeiRange()
682 z = dataOut.data_param[channelIndexList,paramIndex,:]
683 682
683 if dataOut.data_param.ndim == 3:
684 z = dataOut.data_param[channelIndexList,paramIndex,:]
685 else:
686 z = dataOut.data_param[channelIndexList,:]
687
684 688 if showSNR:
685 689 #SNR data
686 690 SNRarray = dataOut.data_SNR[channelIndexList,:]
@@ -721,8 +725,8 class ParametersPlot(Figure):
721 725
722 726 if ymin == None: ymin = numpy.nanmin(y)
723 727 if ymax == None: ymax = numpy.nanmax(y)
724 if zmin == None: zmin = dataOut.abscissaList[0]
725 if zmax == None: zmax = dataOut.abscissaList[-1]
728 if zmin == None: zmin = numpy.nanmin(z)
729 if zmax == None: zmax = numpy.nanmax(z)
726 730
727 731 self.FTP_WEI = ftp_wei
728 732 self.EXP_CODE = exp_code
@@ -1567,3 +1571,377 class PhasePlot(Figure):
1567 1571 wr_period=wr_period,
1568 1572 thisDatetime=thisDatetime,
1569 1573 update_figfile=update_figfile)
1574
1575
1576 class NSMeteorDetection1Plot(Figure):
1577
1578 isConfig = None
1579 __nsubplots = None
1580
1581 WIDTHPROF = None
1582 HEIGHTPROF = None
1583 PREFIX = 'nsm'
1584
1585 zminList = None
1586 zmaxList = None
1587 cmapList = None
1588 titleList = None
1589 nPairs = None
1590 nChannels = None
1591 nParam = None
1592
1593 def __init__(self):
1594
1595 self.isConfig = False
1596 self.__nsubplots = 1
1597
1598 self.WIDTH = 750
1599 self.HEIGHT = 250
1600 self.WIDTHPROF = 120
1601 self.HEIGHTPROF = 0
1602 self.counter_imagwr = 0
1603
1604 self.PLOT_CODE = SPEC_CODE
1605
1606 self.FTP_WEI = None
1607 self.EXP_CODE = None
1608 self.SUB_EXP_CODE = None
1609 self.PLOT_POS = None
1610
1611 self.__xfilter_ena = False
1612 self.__yfilter_ena = False
1613
1614 def getSubplots(self):
1615
1616 ncol = 3
1617 nrow = int(numpy.ceil(self.nplots/3.0))
1618
1619 return nrow, ncol
1620
1621 def setup(self, id, nplots, wintitle, show=True):
1622
1623 self.nplots = nplots
1624
1625 ncolspan = 1
1626 colspan = 1
1627
1628 self.createFigure(id = id,
1629 wintitle = wintitle,
1630 widthplot = self.WIDTH + self.WIDTHPROF,
1631 heightplot = self.HEIGHT + self.HEIGHTPROF,
1632 show=show)
1633
1634 nrow, ncol = self.getSubplots()
1635
1636 counter = 0
1637 for y in range(nrow):
1638 for x in range(ncol):
1639
1640 if counter >= self.nplots:
1641 break
1642
1643 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
1644
1645 counter += 1
1646
1647 def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True,
1648 xmin=None, xmax=None, ymin=None, ymax=None, SNRmin=None, SNRmax=None,
1649 vmin=None, vmax=None, wmin=None, wmax=None, mode = 'SA',
1650 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
1651 server=None, folder=None, username=None, password=None,
1652 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False,
1653 xaxis="frequency"):
1654
1655 """
1656
1657 Input:
1658 dataOut :
1659 id :
1660 wintitle :
1661 channelList :
1662 showProfile :
1663 xmin : None,
1664 xmax : None,
1665 ymin : None,
1666 ymax : None,
1667 zmin : None,
1668 zmax : None
1669 """
1670 #SEPARAR EN DOS PLOTS
1671 nParam = dataOut.data_param.shape[1] - 3
1672
1673 utctime = dataOut.data_param[0,0]
1674 tmet = dataOut.data_param[:,1].astype(int)
1675 hmet = dataOut.data_param[:,2].astype(int)
1676
1677 x = dataOut.abscissaList
1678 y = dataOut.heightList
1679
1680 z = numpy.zeros((nParam, y.size, x.size - 1))
1681 z[:,:] = numpy.nan
1682 z[:,hmet,tmet] = dataOut.data_param[:,3:].T
1683 z[0,:,:] = 10*numpy.log10(z[0,:,:])
1684
1685 xlabel = "Time (s)"
1686 ylabel = "Range (km)"
1687
1688 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime)
1689
1690 if not self.isConfig:
1691
1692 nplots = nParam
1693
1694 self.setup(id=id,
1695 nplots=nplots,
1696 wintitle=wintitle,
1697 show=show)
1698
1699 if xmin is None: xmin = numpy.nanmin(x)
1700 if xmax is None: xmax = numpy.nanmax(x)
1701 if ymin is None: ymin = numpy.nanmin(y)
1702 if ymax is None: ymax = numpy.nanmax(y)
1703 if SNRmin is None: SNRmin = numpy.nanmin(z[0,:])
1704 if SNRmax is None: SNRmax = numpy.nanmax(z[0,:])
1705 if vmax is None: vmax = numpy.nanmax(numpy.abs(z[1,:]))
1706 if vmin is None: vmin = -vmax
1707 if wmin is None: wmin = 0
1708 if wmax is None: wmax = 50
1709
1710 pairsList = dataOut.groupList
1711 self.nPairs = len(dataOut.groupList)
1712
1713 zminList = [SNRmin, vmin, cmin] + [pmin]*self.nPairs
1714 zmaxList = [SNRmax, vmax, cmax] + [pmax]*self.nPairs
1715 titleList = ["SNR","Radial Velocity","Coherence"]
1716 cmapList = ["jet","RdBu_r","jet"]
1717
1718 for i in range(self.nPairs):
1719 strAux1 = "Phase Difference "+ str(pairsList[i][0]) + str(pairsList[i][1])
1720 titleList = titleList + [strAux1]
1721 cmapList = cmapList + ["RdBu_r"]
1722
1723 self.zminList = zminList
1724 self.zmaxList = zmaxList
1725 self.cmapList = cmapList
1726 self.titleList = titleList
1727
1728 self.FTP_WEI = ftp_wei
1729 self.EXP_CODE = exp_code
1730 self.SUB_EXP_CODE = sub_exp_code
1731 self.PLOT_POS = plot_pos
1732
1733 self.isConfig = True
1734
1735 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
1736
1737 for i in range(nParam):
1738 title = self.titleList[i] + ": " +str_datetime
1739 axes = self.axesList[i]
1740 axes.pcolor(x, y, z[i,:].T,
1741 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=self.zminList[i], zmax=self.zmaxList[i],
1742 xlabel=xlabel, ylabel=ylabel, title=title, colormap=self.cmapList[i],ticksize=9, cblabel='')
1743 self.draw()
1744
1745 if figfile == None:
1746 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
1747 name = str_datetime
1748 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
1749 name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith)
1750 figfile = self.getFilename(name)
1751
1752 self.save(figpath=figpath,
1753 figfile=figfile,
1754 save=save,
1755 ftp=ftp,
1756 wr_period=wr_period,
1757 thisDatetime=thisDatetime)
1758
1759
1760 class NSMeteorDetection2Plot(Figure):
1761
1762 isConfig = None
1763 __nsubplots = None
1764
1765 WIDTHPROF = None
1766 HEIGHTPROF = None
1767 PREFIX = 'nsm'
1768
1769 zminList = None
1770 zmaxList = None
1771 cmapList = None
1772 titleList = None
1773 nPairs = None
1774 nChannels = None
1775 nParam = None
1776
1777 def __init__(self):
1778
1779 self.isConfig = False
1780 self.__nsubplots = 1
1781
1782 self.WIDTH = 750
1783 self.HEIGHT = 250
1784 self.WIDTHPROF = 120
1785 self.HEIGHTPROF = 0
1786 self.counter_imagwr = 0
1787
1788 self.PLOT_CODE = SPEC_CODE
1789
1790 self.FTP_WEI = None
1791 self.EXP_CODE = None
1792 self.SUB_EXP_CODE = None
1793 self.PLOT_POS = None
1794
1795 self.__xfilter_ena = False
1796 self.__yfilter_ena = False
1797
1798 def getSubplots(self):
1799
1800 ncol = 3
1801 nrow = int(numpy.ceil(self.nplots/3.0))
1802
1803 return nrow, ncol
1804
1805 def setup(self, id, nplots, wintitle, show=True):
1806
1807 self.nplots = nplots
1808
1809 ncolspan = 1
1810 colspan = 1
1811
1812 self.createFigure(id = id,
1813 wintitle = wintitle,
1814 widthplot = self.WIDTH + self.WIDTHPROF,
1815 heightplot = self.HEIGHT + self.HEIGHTPROF,
1816 show=show)
1817
1818 nrow, ncol = self.getSubplots()
1819
1820 counter = 0
1821 for y in range(nrow):
1822 for x in range(ncol):
1823
1824 if counter >= self.nplots:
1825 break
1826
1827 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
1828
1829 counter += 1
1830
1831 def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True,
1832 xmin=None, xmax=None, ymin=None, ymax=None, SNRmin=None, SNRmax=None,
1833 vmin=None, vmax=None, wmin=None, wmax=None, mode = 'SA',
1834 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
1835 server=None, folder=None, username=None, password=None,
1836 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False,
1837 xaxis="frequency"):
1838
1839 """
1840
1841 Input:
1842 dataOut :
1843 id :
1844 wintitle :
1845 channelList :
1846 showProfile :
1847 xmin : None,
1848 xmax : None,
1849 ymin : None,
1850 ymax : None,
1851 zmin : None,
1852 zmax : None
1853 """
1854 #Rebuild matrix
1855 utctime = dataOut.data_param[0,0]
1856 cmet = dataOut.data_param[:,1].astype(int)
1857 tmet = dataOut.data_param[:,2].astype(int)
1858 hmet = dataOut.data_param[:,3].astype(int)
1859
1860 nParam = 3
1861 nChan = len(dataOut.groupList)
1862 x = dataOut.abscissaList
1863 y = dataOut.heightList
1864
1865 z = numpy.full((nChan, nParam, y.size, x.size - 1),numpy.nan)
1866 z[cmet,:,hmet,tmet] = dataOut.data_param[:,4:]
1867 z[:,0,:,:] = 10*numpy.log10(z[:,0,:,:]) #logarithmic scale
1868 z = numpy.reshape(z, (nChan*nParam, y.size, x.size-1))
1869
1870 xlabel = "Time (s)"
1871 ylabel = "Range (km)"
1872
1873 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.ltctime)
1874
1875 if not self.isConfig:
1876
1877 nplots = nParam*nChan
1878
1879 self.setup(id=id,
1880 nplots=nplots,
1881 wintitle=wintitle,
1882 show=show)
1883
1884 if xmin is None: xmin = numpy.nanmin(x)
1885 if xmax is None: xmax = numpy.nanmax(x)
1886 if ymin is None: ymin = numpy.nanmin(y)
1887 if ymax is None: ymax = numpy.nanmax(y)
1888 if SNRmin is None: SNRmin = numpy.nanmin(z[0,:])
1889 if SNRmax is None: SNRmax = numpy.nanmax(z[0,:])
1890 if vmax is None: vmax = numpy.nanmax(numpy.abs(z[1,:]))
1891 if vmin is None: vmin = -vmax
1892 if wmin is None: wmin = 0
1893 if wmax is None: wmax = 50
1894
1895 self.nChannels = nChan
1896
1897 zminList = []
1898 zmaxList = []
1899 titleList = []
1900 cmapList = []
1901 for i in range(self.nChannels):
1902 strAux1 = "SNR Channel "+ str(i)
1903 strAux2 = "Radial Velocity Channel "+ str(i)
1904 strAux3 = "Spectral Width Channel "+ str(i)
1905
1906 titleList = titleList + [strAux1,strAux2,strAux3]
1907 cmapList = cmapList + ["jet","RdBu_r","jet"]
1908 zminList = zminList + [SNRmin,vmin,wmin]
1909 zmaxList = zmaxList + [SNRmax,vmax,wmax]
1910
1911 self.zminList = zminList
1912 self.zmaxList = zmaxList
1913 self.cmapList = cmapList
1914 self.titleList = titleList
1915
1916 self.FTP_WEI = ftp_wei
1917 self.EXP_CODE = exp_code
1918 self.SUB_EXP_CODE = sub_exp_code
1919 self.PLOT_POS = plot_pos
1920
1921 self.isConfig = True
1922
1923 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
1924
1925 for i in range(self.nplots):
1926 title = self.titleList[i] + ": " +str_datetime
1927 axes = self.axesList[i]
1928 axes.pcolor(x, y, z[i,:].T,
1929 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=self.zminList[i], zmax=self.zmaxList[i],
1930 xlabel=xlabel, ylabel=ylabel, title=title, colormap=self.cmapList[i],ticksize=9, cblabel='')
1931 self.draw()
1932
1933 if figfile == None:
1934 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
1935 name = str_datetime
1936 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
1937 name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith)
1938 figfile = self.getFilename(name)
1939
1940 self.save(figpath=figpath,
1941 figfile=figfile,
1942 save=save,
1943 ftp=ftp,
1944 wr_period=wr_period,
1945 thisDatetime=thisDatetime)
1946
1947
General Comments 0
You need to be logged in to leave comments. Login now