Changeset 14306 for trunk/FACT++
- Timestamp:
- 08/02/12 13:22:38 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r14305 r14306 1855 1855 1856 1856 #ifdef HAVE_NOVA 1857 1858 vector<pair<ln_equ_posn, double>> fMoonCoords; 1859 1860 void CalcMoonCoords(double jd) 1861 { 1862 jd = floor(jd); 1863 1864 fMoonCoords.clear(); 1865 for (double h=0; h<1; h+=1./(24*12)) 1866 { 1867 ln_equ_posn moon; 1868 ln_get_lunar_equ_coords_prec(jd+h, &moon, 0.01); 1869 1870 const double disk = ln_get_lunar_disk(jd+h); 1871 1872 fMoonCoords.push_back(make_pair(moon, disk)); 1873 } 1874 } 1875 1857 1876 pair<vector<float>, pair<Time, float>> GetVisibility(ln_equ_posn *src, ln_lnlat_posn *observer, double jd) 1858 1877 { … … 1870 1889 int cnt = 0; 1871 1890 1891 int i=0; 1892 1872 1893 vector<float> alt; 1873 for (double h=0; h<1; h+=1./(24*12) )1894 for (double h=0; h<1; h+=1./(24*12), i++) 1874 1895 { 1875 1896 if (src==0) 1876 ln_get_lunar_equ_coords(jd+h, &moon);1897 moon = fMoonCoords[i].first; //ln_get_lunar_equ_coords_prec(jd+h, &moon, 0.01); 1877 1898 1878 1899 ln_hrz_posn hrz; … … 1905 1926 const double jd1 = fmod(fSun.fRiseAstronomical.JD(), 1); 1906 1927 1907 ln_equ_posn moon;1908 1909 1928 double max = -1; 1910 1929 double maxjd = 0; 1911 1930 1912 1931 int cnt = 0; 1913 1914 vector<float> alt; 1915 for (double h=0; h<1; h+=1./(24*12)) 1916 { 1917 double lc = -1; 1932 int i = 0; 1933 1934 vector<float> vec; 1935 for (double h=0; h<1; h+=1./(24*12), i++) 1936 { 1937 double cur = -1; 1918 1938 1919 1939 if (h>jd0 && h<jd1) 1920 1940 { 1921 const double disk = ln_get_lunar_disk(jd+h);1922 ln_get_lunar_equ_coords(jd+h, &moon);1941 ln_equ_posn moon = fMoonCoords[i].first;//ln_get_lunar_equ_coords_prec(jd+h, &moon, 0.01); 1942 const double disk = fMoonCoords[i].second;//ln_get_lunar_disk(jd+h); 1923 1943 1924 1944 ln_hrz_posn hrz; … … 1931 1951 const double angle = m.Angle(src->ra, src->dec); 1932 1952 1933 lc = angle*hrz.alt*disk*M_PI*M_PI/180/180; 1934 1935 alt.push_back(lc); 1953 const double lc = angle*hrz.alt*pow(disk, 6)/360/360; 1954 1955 cur = 7.7+4942*lc; 1956 1957 vec.push_back(cur); // Covert LC to pixel current in uA 1936 1958 } 1937 1959 1938 if ( lc>max)1960 if (cur>max) 1939 1961 { 1940 max = lc;1962 max = cur; 1941 1963 maxjd = jd+h; 1942 1964 } 1943 1965 1944 if (h>jd0 && h<jd1 && lc>0)1966 if (h>jd0 && h<jd1 && cur>0) 1945 1967 cnt++; 1946 1968 } 1947 1969 1948 if (max< =15|| cnt==0)1970 if (max<0 || cnt==0) 1949 1971 return make_pair(vector<float>(), make_pair(Time(), 0)); 1950 1972 1951 return make_pair( alt, make_pair(maxjd, maxjd>jd+jd0&&maxjd<jd+jd1?max:0));1973 return make_pair(vec, make_pair(maxjd, maxjd>jd+jd0&&maxjd<jd+jd1?max:0)); 1952 1974 } 1953 1975 #endif … … 1959 1981 1960 1982 Time now; 1983 1984 CalcMoonCoords(now.JD()); 1961 1985 1962 1986 fSun = Sun (lon, lat, now); … … 2020 2044 map<Time, pair<string, float>> lightcond; 2021 2045 vector<vector<float>> alt; 2022 vector<vector<float>> hlc;2046 vector<vector<float>> cur; 2023 2047 2024 2048 #ifdef HAVE_NOVA … … 2069 2093 if (lc.first.size()>0) 2070 2094 { 2071 hlc.push_back(lc.first);2095 cur.push_back(lc.first); 2072 2096 lightcond[lc.second.first] = make_pair(name, lc.second.second); 2073 2097 } … … 2111 2135 } 2112 2136 2137 out4 << setprecision(3); 2113 2138 for (auto it=lightcond.begin(); it!=lightcond.end(); it++) 2114 2139 { … … 2117 2142 out4 << "<B>" << it->second.first << "</B>"; 2118 2143 if (it->second.second>0) 2119 out4 << " [" << nearbyint( 90-it->second.second) << "°]";2144 out4 << " [" << nearbyint(it->second.second) << "]"; 2120 2145 } 2121 2146 … … 2134 2159 out2 << HTML::kWhite << '\t' << Time()-now << '\n'; 2135 2160 2136 WriteBinaryVec(now, "hist-visibility", alt,75, 15, "Alt "+title.str());2137 WriteBinaryVec(now, "hist- light-condition", hlc, 1, 0, "LC "+title.str());2161 WriteBinaryVec(now, "hist-visibility", alt, 75, 15, "Alt "+title.str()); 2162 WriteBinaryVec(now, "hist-current-prediction", cur, 100, 0, "I " +title.str()); 2138 2163 } 2139 2164 catch (const exception &e) … … 2151 2176 ofstream(fPath+"/source-list.data") << out2.str(); 2152 2177 ofstream(fPath+"/visibility.data") << out3.str(); 2153 ofstream(fPath+"/ light-condition.data") << out4.str();2178 ofstream(fPath+"/current-prediction.data") << out4.str(); 2154 2179 } 2155 2180
Note:
See TracChangeset
for help on using the changeset viewer.