Changeset 34426
- Timestamp:
- Sep 11, 2012, 10:21:10 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120905/Ohana/src/addstar/src/ReadStarsFITS.c
r34405 r34426 606 606 stars[i].measure.psfChisq = ps1data[i].psfChisq; 607 607 stars[i].measure.psfQF = ps1data[i].psfQF; 608 stars[i].measure.psfQFperf = ps1data[i].psfQFpef; 608 609 stars[i].measure.psfNdof = ps1data[i].psfNdof; 609 610 stars[i].measure.psfNpix = ps1data[i].psfNpix; … … 675 676 stars[i].measure.dMkron = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN; 676 677 678 // these fluxes are converted from counts to counts/sec in FilterStars.c 679 stars[i].measure.FluxPSF = ps1data[i].Flux; 680 stars[i].measure.dFluxPSF = ps1data[i].dFlux; 681 stars[i].measure.FluxKron = ps1data[i].kronFlux; 682 stars[i].measure.dFluxKron = ps1data[i].kronFluxErr; 683 684 stars[i].measure.Sky = ps1data[i].sky; 685 stars[i].measure.dSky = ps1data[i].dSky; 686 687 stars[i].measure.psfChisq = ps1data[i].psfChisq; 688 stars[i].measure.psfQF = ps1data[i].psfQF; 689 stars[i].measure.psfQFperf = ps1data[i].psfQFpef; 690 stars[i].measure.psfNdof = ps1data[i].psfNdof; 691 stars[i].measure.psfNpix = ps1data[i].psfNpix; 692 stars[i].measure.crNsigma = ps1data[i].crNsigma; 693 stars[i].measure.extNsigma = ps1data[i].extNsigma; 694 695 stars[i].measure.FWx = ToShortPixels(ps1data[i].fx); 696 stars[i].measure.FWy = ToShortPixels(ps1data[i].fy); 697 stars[i].measure.theta = ToShortDegrees(ps1data[i].df); 698 699 stars[i].measure.Mxx = ToShortPixels(ps1data[i].Mxx); 700 stars[i].measure.Mxy = ToShortPixels(ps1data[i].Mxy); 701 stars[i].measure.Myy = ToShortPixels(ps1data[i].Myy); 702 703 stars[i].measure.photFlags = ps1data[i].flags; 704 705 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 706 stars[i].measure.detID = ps1data[i].detID; 707 708 // the Average fields and the following Measure fields are set in FilterStars after 709 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID. 710 711 // averef is set in find_matches 712 713 // dbFlags is zero on ingest. 714 715 // the following fields are currently not being set anywhere: t_msec 716 } 717 *nstars = Nstars; 718 return (stars); 719 } 720 721 Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) { 722 723 off_t Nstars; 724 unsigned int i; 725 double ZeroPt; 726 Stars *stars; 727 CMF_PS1_SV1 *ps1data; 728 729 if (table[0].header[0].Naxis[0] == 196) { 730 stars = Convert_PS1_SV1_Alt (table, nstars); 731 return (stars); 732 } 733 734 ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL); 735 if (!ps1data) { 736 fprintf (stderr, "skipping inconsistent entry\n"); 737 return (NULL); 738 } 739 ZeroPt = GetZeroPoint(); 740 741 ALLOCATE (stars, Stars, Nstars); 742 for (i = 0; i < Nstars; i++) { 743 InitStar (&stars[i]); 744 stars[i].measure.Xccd = ps1data[i].X; 745 stars[i].measure.Yccd = ps1data[i].Y; 746 stars[i].measure.dXccd = ToShortPixels(ps1data[i].dX); 747 stars[i].measure.dYccd = ToShortPixels(ps1data[i].dY); 748 749 stars[i].measure.posangle = ToShortDegrees(ps1data[i].posangle); 750 stars[i].measure.pltscale = ps1data[i].pltscale; 751 752 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 753 stars[i].measure.M = NAN; 754 } else { 755 stars[i].measure.M = ps1data[i].M + ZeroPt; 756 } 757 stars[i].measure.dM = ps1data[i].dM; 758 stars[i].measure.dMcal = ps1data[i].dMcal; 759 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 760 761 stars[i].measure.Mkron = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN; 762 stars[i].measure.dMkron = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN; 763 764 // these fluxes are converted from counts to counts/sec in FilterStars.c 765 stars[i].measure.FluxPSF = ps1data[i].Flux; 766 stars[i].measure.dFluxPSF = ps1data[i].dFlux; 767 stars[i].measure.FluxKron = ps1data[i].kronFlux; 768 stars[i].measure.dFluxKron = ps1data[i].kronFluxErr; 769 770 stars[i].measure.Sky = ps1data[i].sky; 771 stars[i].measure.dSky = ps1data[i].dSky; 772 773 stars[i].measure.psfChisq = ps1data[i].psfChisq; 774 stars[i].measure.psfQF = ps1data[i].psfQF; 775 stars[i].measure.psfQFperf = ps1data[i].psfQFpef; 776 stars[i].measure.psfNdof = ps1data[i].psfNdof; 777 stars[i].measure.psfNpix = ps1data[i].psfNpix; 778 stars[i].measure.crNsigma = ps1data[i].crNsigma; 779 stars[i].measure.extNsigma = ps1data[i].extNsigma; 780 781 stars[i].measure.FWx = ToShortPixels(ps1data[i].fx); 782 stars[i].measure.FWy = ToShortPixels(ps1data[i].fy); 783 stars[i].measure.theta = ToShortDegrees(ps1data[i].df); 784 785 stars[i].measure.Mxx = ToShortPixels(ps1data[i].Mxx); 786 stars[i].measure.Mxy = ToShortPixels(ps1data[i].Mxy); 787 stars[i].measure.Myy = ToShortPixels(ps1data[i].Myy); 788 789 stars[i].measure.photFlags = ps1data[i].flags; 790 791 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 792 stars[i].measure.detID = ps1data[i].detID; 793 794 // the Average fields and the following Measure fields are set in FilterStars after 795 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 796 // averef is set in find_matches, dbFlags is zero on ingest. 797 798 // the following fields are currently not being set anywhere: t_msec 799 } 800 *nstars = Nstars; 801 return (stars); 802 } 803 804 Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) { 805 806 off_t Nstars; 807 unsigned int i; 808 double ZeroPt; 809 Stars *stars; 810 CMF_PS1_SV1 *ps1data; 811 812 // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries 813 814 ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL); 815 if (!ps1data) { 816 fprintf (stderr, "skipping inconsistent entry\n"); 817 return (NULL); 818 } 819 ZeroPt = GetZeroPoint(); 820 821 ALLOCATE (stars, Stars, Nstars); 822 for (i = 0; i < Nstars; i++) { 823 InitStar (&stars[i]); 824 stars[i].measure.Xccd = ps1data[i].X; 825 stars[i].measure.Yccd = ps1data[i].Y; 826 stars[i].measure.dXccd = ToShortPixels(ps1data[i].dX); 827 stars[i].measure.dYccd = ToShortPixels(ps1data[i].dY); 828 829 stars[i].measure.posangle = ToShortDegrees(ps1data[i].posangle); 830 stars[i].measure.pltscale = ps1data[i].pltscale; 831 832 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 833 stars[i].measure.M = NAN; 834 } else { 835 stars[i].measure.M = ps1data[i].M + ZeroPt; 836 } 837 stars[i].measure.dM = ps1data[i].dM; 838 stars[i].measure.dMcal = ps1data[i].dMcal; 839 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 840 841 stars[i].measure.Mkron = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN; 842 stars[i].measure.dMkron = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN; 843 677 844 // these fluxes are converted from counts to counts/sec in FilterStars.c 678 845 stars[i].measure.FluxPSF = ps1data[i].Flux; … … 705 872 706 873 // the Average fields and the following Measure fields are set in FilterStars after 707 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID. 708 709 // averef is set in find_matches 710 711 // dbFlags is zero on ingest. 874 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 875 // averef is set in find_matches, dbFlags is zero on ingest. 712 876 713 877 // the following fields are currently not being set anywhere: t_msec … … 717 881 } 718 882 719 Stars *Convert_PS1_SV 1(FTable *table, unsigned int *nstars) {883 Stars *Convert_PS1_SV2 (FTable *table, unsigned int *nstars) { 720 884 721 885 off_t Nstars; … … 723 887 double ZeroPt; 724 888 Stars *stars; 725 CMF_PS1_SV1 *ps1data; 726 727 if (table[0].header[0].Naxis[0] == 196) { 728 stars = Convert_PS1_SV1_Alt (table, nstars); 729 return (stars); 730 } 731 732 ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL); 889 CMF_PS1_SV2 *ps1data; 890 891 ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL); 733 892 if (!ps1data) { 734 893 fprintf (stderr, "skipping inconsistent entry\n"); … … 771 930 stars[i].measure.psfChisq = ps1data[i].psfChisq; 772 931 stars[i].measure.psfQF = ps1data[i].psfQF; 932 stars[i].measure.psfQFperf = ps1data[i].psfQFpef; 773 933 stars[i].measure.psfNdof = ps1data[i].psfNdof; 774 934 stars[i].measure.psfNpix = ps1data[i].psfNpix; … … 799 959 } 800 960 801 Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) { 802 803 off_t Nstars; 804 unsigned int i; 805 double ZeroPt; 806 Stars *stars; 807 CMF_PS1_SV1 *ps1data; 808 809 // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries 810 811 ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL); 812 if (!ps1data) { 813 fprintf (stderr, "skipping inconsistent entry\n"); 814 return (NULL); 815 } 816 ZeroPt = GetZeroPoint(); 817 818 ALLOCATE (stars, Stars, Nstars); 819 for (i = 0; i < Nstars; i++) { 820 InitStar (&stars[i]); 821 stars[i].measure.Xccd = ps1data[i].X; 822 stars[i].measure.Yccd = ps1data[i].Y; 823 stars[i].measure.dXccd = ToShortPixels(ps1data[i].dX); 824 stars[i].measure.dYccd = ToShortPixels(ps1data[i].dY); 825 826 stars[i].measure.posangle = ToShortDegrees(ps1data[i].posangle); 827 stars[i].measure.pltscale = ps1data[i].pltscale; 828 829 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 830 stars[i].measure.M = NAN; 831 } else { 832 stars[i].measure.M = ps1data[i].M + ZeroPt; 833 } 834 stars[i].measure.dM = ps1data[i].dM; 835 stars[i].measure.dMcal = ps1data[i].dMcal; 836 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 837 838 stars[i].measure.Mkron = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN; 839 stars[i].measure.dMkron = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN; 840 841 // these fluxes are converted from counts to counts/sec in FilterStars.c 842 stars[i].measure.FluxPSF = ps1data[i].Flux; 843 stars[i].measure.dFluxPSF = ps1data[i].dFlux; 844 stars[i].measure.FluxKron = ps1data[i].kronFlux; 845 stars[i].measure.dFluxKron = ps1data[i].kronFluxErr; 846 847 stars[i].measure.Sky = ps1data[i].sky; 848 stars[i].measure.dSky = ps1data[i].dSky; 849 850 stars[i].measure.psfChisq = ps1data[i].psfChisq; 851 stars[i].measure.psfQF = ps1data[i].psfQF; 852 stars[i].measure.psfNdof = ps1data[i].psfNdof; 853 stars[i].measure.psfNpix = ps1data[i].psfNpix; 854 stars[i].measure.crNsigma = ps1data[i].crNsigma; 855 stars[i].measure.extNsigma = ps1data[i].extNsigma; 856 857 stars[i].measure.FWx = ToShortPixels(ps1data[i].fx); 858 stars[i].measure.FWy = ToShortPixels(ps1data[i].fy); 859 stars[i].measure.theta = ToShortDegrees(ps1data[i].df); 860 861 stars[i].measure.Mxx = ToShortPixels(ps1data[i].Mxx); 862 stars[i].measure.Mxy = ToShortPixels(ps1data[i].Mxy); 863 stars[i].measure.Myy = ToShortPixels(ps1data[i].Myy); 864 865 stars[i].measure.photFlags = ps1data[i].flags; 866 867 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 868 stars[i].measure.detID = ps1data[i].detID; 869 870 // the Average fields and the following Measure fields are set in FilterStars after 871 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 872 // averef is set in find_matches, dbFlags is zero on ingest. 873 874 // the following fields are currently not being set anywhere: t_msec 875 } 876 *nstars = Nstars; 877 return (stars); 878 } 879 880 Stars *Convert_PS1_SV2 (FTable *table, unsigned int *nstars) { 881 882 off_t Nstars; 883 unsigned int i; 884 double ZeroPt; 885 Stars *stars; 886 CMF_PS1_SV2 *ps1data; 887 888 ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL); 889 if (!ps1data) { 890 fprintf (stderr, "skipping inconsistent entry\n"); 891 return (NULL); 892 } 893 ZeroPt = GetZeroPoint(); 894 895 ALLOCATE (stars, Stars, Nstars); 896 for (i = 0; i < Nstars; i++) { 897 InitStar (&stars[i]); 898 stars[i].measure.Xccd = ps1data[i].X; 899 stars[i].measure.Yccd = ps1data[i].Y; 900 stars[i].measure.dXccd = ToShortPixels(ps1data[i].dX); 901 stars[i].measure.dYccd = ToShortPixels(ps1data[i].dY); 902 903 stars[i].measure.posangle = ToShortDegrees(ps1data[i].posangle); 904 stars[i].measure.pltscale = ps1data[i].pltscale; 905 906 if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) { 907 stars[i].measure.M = NAN; 908 } else { 909 stars[i].measure.M = ps1data[i].M + ZeroPt; 910 } 911 stars[i].measure.dM = ps1data[i].dM; 912 stars[i].measure.dMcal = ps1data[i].dMcal; 913 stars[i].measure.Map = ps1data[i].Map + ZeroPt; 914 915 stars[i].measure.Mkron = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN; 916 stars[i].measure.dMkron = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN; 917 918 // these fluxes are converted from counts to counts/sec in FilterStars.c 919 stars[i].measure.FluxPSF = ps1data[i].Flux; 920 stars[i].measure.dFluxPSF = ps1data[i].dFlux; 921 stars[i].measure.FluxKron = ps1data[i].kronFlux; 922 stars[i].measure.dFluxKron = ps1data[i].kronFluxErr; 923 924 stars[i].measure.Sky = ps1data[i].sky; 925 stars[i].measure.dSky = ps1data[i].dSky; 926 927 stars[i].measure.psfChisq = ps1data[i].psfChisq; 928 stars[i].measure.psfQF = ps1data[i].psfQF; 929 stars[i].measure.psfNdof = ps1data[i].psfNdof; 930 stars[i].measure.psfNpix = ps1data[i].psfNpix; 931 stars[i].measure.crNsigma = ps1data[i].crNsigma; 932 stars[i].measure.extNsigma = ps1data[i].extNsigma; 933 934 stars[i].measure.FWx = ToShortPixels(ps1data[i].fx); 935 stars[i].measure.FWy = ToShortPixels(ps1data[i].fy); 936 stars[i].measure.theta = ToShortDegrees(ps1data[i].df); 937 938 stars[i].measure.Mxx = ToShortPixels(ps1data[i].Mxx); 939 stars[i].measure.Mxy = ToShortPixels(ps1data[i].Mxy); 940 stars[i].measure.Myy = ToShortPixels(ps1data[i].Myy); 941 942 stars[i].measure.photFlags = ps1data[i].flags; 943 944 // this is may optionally be replaced by the internal sequence (see FilterStars.c) 945 stars[i].measure.detID = ps1data[i].detID; 946 947 // the Average fields and the following Measure fields are set in FilterStars after 948 // the image metadata is in hand: dR, dD, Mcal, dt, airmass, az, t, imageID, extID, 949 // averef is set in find_matches, dbFlags is zero on ingest. 950 951 // the following fields are currently not being set anywhere: t_msec 952 } 953 *nstars = Nstars; 954 return (stars); 955 } 956 957 961
Note:
See TracChangeset
for help on using the changeset viewer.
