Changeset 673 in Sophya for trunk/SophyaExt/FitsIOServer/fitsioserver.cc
- Timestamp:
- Dec 6, 1999, 6:11:36 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/FitsIOServer/fitsioserver.cc
r664 r673 169 169 ttype= new char*[tfields]; 170 170 tform= new char*[tfields]; 171 for( int ii = 0; ii < tfields; ii++) 171 int ii; 172 for(ii = 0; ii < tfields; ii++) 172 173 { 173 174 ttype[ii]= new char[FLEN_VALUE]; … … 192 193 long repeat,width; 193 194 list<int> column; 194 for( intii = 0; ii < tfields; ii++)195 for(ii = 0; ii < tfields; ii++) 195 196 { 196 197 fits_binary_tform(tform[ii],&typecode, &repeat, &width, &status); … … 203 204 char **clname; 204 205 clname= new char*[column.size()]; 205 for(i nt ii = 0; ii < column.size(); ii++)206 for(ii = 0; ii < column.size(); ii++) 206 207 clname[ii]= new char[FLEN_VALUE]; 207 208 … … 211 212 strcpy(clname[index++],ttype[*itr-1]); 212 213 213 for( intii = 0; ii < tfields; ii++)214 for(ii = 0; ii < tfields; ii++) 214 215 { 215 216 delete [] ttype[ii]; … … 230 231 NTuple nt0(column.size(),clname,blk); 231 232 232 for(i nt ii = 0; ii < column.size(); ii++)233 for(ii = 0; ii < column.size(); ii++) 233 234 delete [] clname[ii]; 234 235 delete [] clname; … … 239 240 strcpy(strnull, " "); 240 241 int anynull= 0; 241 long longnull = 0;242 242 243 243 // value to represent undefined array elements … … 264 264 char keyname[LEN_KEYWORD]= ""; 265 265 char strval[FLEN_VALUE]; 266 for(i nt ii = 0; ii < tfields; ii++)266 for(ii = 0; ii < tfields; ii++) 267 267 { 268 268 fits_make_keyn("TUNIT",ii+1,keyname,&status); … … 722 722 ttype= new char*[tfields]; 723 723 tform= new char*[tfields]; 724 for(int i = 0; i < tfields; i++) 724 int i; 725 for(i = 0; i < tfields; i++) 725 726 { 726 727 ttype[i]= new char[FLEN_VALUE]; … … 752 753 int firstelem = 1; 753 754 754 for(i nt i= 0; i < tfields; i++)755 for(i = 0; i < tfields; i++) 755 756 { 756 757 float *dens= new float[nrows]; … … 979 980 int siz_x = DpcImg.XSize(); 980 981 int siz_y = DpcImg.YSize(); 981 int nbpixels = siz_x*siz_y;982 982 FITS_tab_typ_ = TFLOAT; 983 983 … … 1028 1028 int siz_x = DpcImg.XSize(); 1029 1029 int siz_y = DpcImg.YSize(); 1030 int nbpixels = siz_x*siz_y;1031 1030 FITS_tab_typ_ = TINT; 1032 1031 … … 1722 1721 cout << " image FITS en projection SINUS" << endl; 1723 1722 // table will have npixels rows 1724 for(int j=0; j < npixels; j++) map[j]=0.; 1725 for(int j=0; j<naxes[1]; j++) 1723 int i,j; 1724 for(j=0; j < npixels; j++) map[j]=0.; 1725 1726 for(j=0; j<naxes[1]; j++) 1726 1727 { 1727 1728 double yd = (j+0.5)/naxes[1]-0.5; 1728 1729 double theta = (0.5-yd)*Pi; 1729 1730 double facteur=1./sin(theta); 1730 for(i nt i=0; i<naxes[0]; i++)1731 for(i=0; i<naxes[0]; i++) 1731 1732 { 1732 1733 double xa = (i+0.5)/naxes[0]-0.5; … … 1760 1761 cout << " image FITS en projection SINUS" << endl; 1761 1762 // table will have npixels rows 1762 for(int j=0; j < npixels; j++) map[j]=0.; 1763 for(int j=0; j<naxes[1]; j++) 1763 int i,j; 1764 for(j=0; j < npixels; j++) map[j]=0.; 1765 for(j=0; j<naxes[1]; j++) 1764 1766 { 1765 1767 double yd = (j+0.5)/naxes[1]-0.5; 1766 1768 double theta = (0.5-yd)*Pi; 1767 1769 double facteur=1./sin(theta); 1768 for(i nt i=0; i<naxes[0]; i++)1770 for(i=0; i<naxes[0]; i++) 1769 1771 { 1770 1772 double xa = (i+0.5)/naxes[0]-0.5; … … 1787 1789 // a FITS-file 1788 1790 void FitsIoServer::Mollweide_picture_projection(SphericalMap<float>& sph, char filename[]) 1791 { 1792 // le code de cete methode duplique celui de la precedente, la seule 1793 //difference etant le type de sphere en entree. Ces methodes de projection 1794 // sont provisoires, et ne servent que pour les tests. C est pourquoi je 1795 // ne me suis pas casse la tete, pour l instant 1796 1797 long naxes[2]={600, 300}; 1798 float* map = new float[ 600*300 ]; 1799 int npixels= naxes[0]*naxes[1]; 1800 1801 cout << " image FITS en projection MOLLWEIDE" << endl; 1802 // table will have npixels rows 1803 int i,j; 1804 for(j=0; j < npixels; j++) map[j]=0.; 1805 for(j=0; j<naxes[1]; j++) 1806 { 1807 double yd = (j+0.5)/naxes[1]-0.5; 1808 double facteur=2.*Pi/sin(acos(yd*2)); 1809 double theta = (0.5-yd)*Pi; 1810 for(i=0; i<naxes[0]; i++) 1811 { 1812 double xa = (i+0.5)/naxes[0]-0.5; 1813 double phi = xa*facteur+Pi; 1814 float th=float(theta); 1815 float ff=float(phi); 1816 if (phi<2*Pi && phi>= 0) 1817 { 1818 map[j*naxes[0]+i] = sph.PixValSph(th, ff); 1819 } 1820 } 1821 } 1822 1823 write_picture(naxes, map, filename); 1824 delete [] map; 1825 1826 } 1827 // projects a SphericalMap<double>, according Mollweide-method, and saves onto 1828 // a FITS-file 1829 void FitsIoServer::Mollweide_picture_projection(SphericalMap<double>& sph, char filename[]) 1789 1830 { 1790 1831 // le code de cete methode duplique celui de la precedente, la seule … … 1822 1863 1823 1864 } 1824 // projects a SphericalMap<double>, according Mollweide-method, and saves onto1825 // a FITS-file1826 void FitsIoServer::Mollweide_picture_projection(SphericalMap<double>& sph, char filename[])1827 {1828 // le code de cete methode duplique celui de la precedente, la seule1829 //difference etant le type de sphere en entree. Ces methodes de projection1830 // sont provisoires, et ne servent que pour les tests. C est pourquoi je1831 // ne me suis pas casse la tete, pour l instant1832 1833 long naxes[2]={600, 300};1834 float* map = new float[ 600*300 ];1835 int npixels= naxes[0]*naxes[1];1836 1837 cout << " image FITS en projection MOLLWEIDE" << endl;1838 // table will have npixels rows1839 for(int j=0; j < npixels; j++) map[j]=0.;1840 for(int j=0; j<naxes[1]; j++)1841 {1842 double yd = (j+0.5)/naxes[1]-0.5;1843 double facteur=2.*Pi/sin(acos(yd*2));1844 double theta = (0.5-yd)*Pi;1845 for(int i=0; i<naxes[0]; i++)1846 {1847 double xa = (i+0.5)/naxes[0]-0.5;1848 double phi = xa*facteur+Pi;1849 float th=float(theta);1850 float ff=float(phi);1851 if (phi<2*Pi && phi>= 0)1852 {1853 map[j*naxes[0]+i] = sph.PixValSph(th, ff);1854 }1855 }1856 }1857 1858 write_picture(naxes, map, filename);1859 delete [] map;1860 1861 }1862 1865 1863 1866 … … 1875 1878 1876 1879 // table will have npixels rows 1877 for(int j=0; j < npixels; j++) map[j]=0.; 1878 for(int j=0; j<naxes[1]; j++) 1880 int i,j; 1881 for(j=0; j < npixels; j++) map[j]=0.; 1882 for(j=0; j<naxes[1]; j++) 1879 1883 { 1880 for(i nt i=0; i<naxes[0]; i++)1884 for(i=0; i<naxes[0]; i++) 1881 1885 { 1882 1886 map[j*naxes[0]+i] = lcm(i, j); … … 1917 1921 1918 1922 // first row in table to write 1919 long firstrow = 1;1923 // long firstrow = 1; Not referenced 1920 1924 // first element in row 1921 1925 long firstelem = 1; 1922 int colnum = 1;1926 // int colnum = 1; Not referenced 1923 1927 int nelements=naxes[0]*naxes[1]; 1924 1928 fits_write_img(fptr, TFLOAT, firstelem, nelements, map, &status);
Note:
See TracChangeset
for help on using the changeset viewer.