Changeset 17172
- Timestamp:
- 09/19/13 15:08:22 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r17169 r17172 1700 1700 rms = rms<0 ? 0 : sqrt(rms); 1701 1701 1702 // Clean broken reports 1703 static double pre_rms1 = 1.5; 1704 static double pre_rms2 = 0; 1705 1706 const double cut = pre_rms1 + 0.1; 1707 1708 const bool reject = rms>cut && pre_rms2<cut; 1709 1710 pre_rms2 = pre_rms1; 1711 pre_rms1 = rms; 1712 1713 if (reject) 1714 return GetCurrentState(); 1715 1716 1702 1717 if (!fMagicWeatherHist[kTemp].empty()) 1703 1718 { … … 1731 1746 ofstream(fPath+"/camtemp.data") << out.str(); 1732 1747 1733 // ======================================================= 1734 1735 static vector<pair<double,double>> fPositionsSensors; 1736 static vector<pair<double,double>> fPositionsBias; 1737 1738 if (fPositionsSensors.empty()) 1739 { 1740 ifstream fin1("sensor-pos.txt"); 1741 while (1) 1742 { 1743 double x, y; 1744 fin1 >> x; 1745 fin1 >> y; 1746 if (!fin1) 1747 break; 1748 1749 fPositionsSensors.emplace_back(x, y); 1750 } 1751 1752 if (fPositionsSensors.size() != 31) 1753 Fatal("Reading sensor positions failed ("+to_string(fPositionsSensors.size())+")"); 1754 } 1755 1756 if (fPositionsBias.empty()) 1757 { 1758 ifstream fin1("bias-positions.txt"); 1759 while (1) 1760 { 1761 double x, y; 1762 fin1 >> x; 1763 fin1 >> y; 1764 if (!fin1) 1765 break; 1766 1767 fPositionsBias.emplace_back(x, y); 1768 } 1769 1770 if (fPositionsBias.size() != 320) 1771 Fatal("Reading bias positions failed ("+to_string(fPositionsBias.size())+")"); 1772 } 1773 1774 if (!fPositionsBias.size()==320 || !fPositionsSensors.size()==31) 1748 return GetCurrentState(); 1749 } 1750 1751 int HandleFscBiasTemp(const EventImp &d) 1752 { 1753 if (!CheckDataSize(d, "FscControl:BiasTemp", 321*4)) 1775 1754 return GetCurrentState(); 1776 1755 1777 vector<double> temp; 1778 vector<Interpolator2D::vec> xy; 1779 for (int i=0; i<31; i++) 1780 if (ptr[i]!=0) 1781 { 1782 temp.emplace_back(ptr[i]); 1783 xy.emplace_back(fPositionsSensors[i].first, fPositionsSensors[i].second); 1784 } 1785 1786 Interpolator2D inter(xy); 1787 if (!inter.SetOutputGrid(fPositionsBias)) 1788 return GetCurrentState(); 1789 1790 const vector<double> T = inter.Interpolate(temp); 1756 const float *ptr = d.Ptr<float>(4); 1791 1757 1792 1758 vector<double> tout(320); … … 1795 1761 { 1796 1762 const int idx = (fPixelMap.hv(i).hw()/9)*2+fPixelMap.hv(i).group(); 1797 tout[idx] = T[i];1798 pavg += T[i];1799 } 1800 1801 WriteCam(d, "cam-fsccontrol-temperature", tout, 3, pavg/320-1. 5);1763 tout[idx] = ptr[i]; 1764 pavg += ptr[i]; 1765 } 1766 1767 WriteCam(d, "cam-fsccontrol-temperature", tout, 3, pavg/320-1.75); 1802 1768 1803 1769 return GetCurrentState(); … … 2997 2963 Subscribe("FSC_CONTROL/HUMIDITY") 2998 2964 (bind(&StateMachineSmartFACT::HandleFscHumidity, this, placeholders::_1)); 2965 Subscribe("FSC_CONTROL/BIAS_TEMP") 2966 (bind(&StateMachineSmartFACT::HandleFscBiasTemp, this, placeholders::_1)); 2999 2967 3000 2968 Subscribe("MAGIC_WEATHER/DATA")
Note:
See TracChangeset
for help on using the changeset viewer.