Commits

David Mehringer authored 4006fd62aa4
refactor
No tags

code/imageanalysis/ImageAnalysis/ImagePolarimetry.cc

Modified
867 867 CoordinateSystem tmp;
868 868 cSys = tmp;
869 869 for (Int i=0; i<Int(cSys0.nCoordinates()); ++i) {
870 870 if (i != spectralCoord && i != stokesCoord) {
871 871 cSys.addCoordinate(cSys0.coordinate(i));
872 872 }
873 873 }
874 874 return shape;
875 875 }
876 876
877 -IPosition ImagePolarimetry::positionAngleShape(CoordinateSystem& cSys,
878 - Int& fAxis, Int& sAxis, LogIO&, Int spectralAxis) const
879 -{
880 -
881 -// Construction image CS
882 -
883 - CoordinateSystem cSys0 = coordinates();
884 -
885 -// Find frequency axis
886 -
887 - Int spectralCoord = -1;
888 - _findFrequencyAxis (spectralCoord, fAxis, cSys0, spectralAxis);
889 -
890 -// Find Stokes axis (we know it has one)
891 -
892 - Int afterCoord = -1;
893 - Int stokesCoord = cSys0.findCoordinate(Coordinate::STOKES, afterCoord);
894 - Vector<Int> pixelAxes = cSys0.pixelAxes(stokesCoord);
895 - sAxis = pixelAxes(0);
896 - _fiddleStokesCoordinate(cSys0, Stokes::Pangle);
897 -// Create output coordinate system
898 -
899 - CoordinateSystem tmp;
900 - cSys = tmp;
901 - for (Int i=0;i<Int(cSys0.nCoordinates()); i++) {
902 - if (i!=spectralCoord) {
903 - cSys.addCoordinate(cSys0.coordinate(i));
904 - }
905 - }
906 -
907 -// What shape should the image be ? Frequency axis should be gone.
908 -// and Stokes length 1
909 -
910 - IPosition shape0 = ImagePolarimetry::shape();
911 - IPosition shape(shape0.nelements()-1);
912 -//
913 - Int j = 0;
914 - for (Int i=0; i<Int(shape0.nelements()); i++) {
915 - if (i==sAxis) {
916 - shape(j) = 1;
917 - j++;
918 - } else {
919 - if (i!=fAxis) {
920 - shape(j) = shape0(i);
921 - j++;
877 +IPosition ImagePolarimetry::positionAngleShape(
878 + CoordinateSystem& cSys, Int& fAxis, Int& sAxis, LogIO&, Int spectralAxis
879 +) const {
880 + CoordinateSystem cSys0 = coordinates();
881 + Int spectralCoord = -1;
882 + _findFrequencyAxis (spectralCoord, fAxis, cSys0, spectralAxis);
883 + Int afterCoord = -1;
884 + Int stokesCoord = cSys0.findCoordinate(Coordinate::STOKES, afterCoord);
885 + Vector<Int> pixelAxes = cSys0.pixelAxes(stokesCoord);
886 + sAxis = pixelAxes(0);
887 + _fiddleStokesCoordinate(cSys0, Stokes::Pangle);
888 + CoordinateSystem tmp;
889 + cSys = tmp;
890 + for (Int i=0; i<Int(cSys0.nCoordinates()); ++i) {
891 + if (i != spectralCoord) {
892 + cSys.addCoordinate(cSys0.coordinate(i));
893 + }
894 + }
895 + // What shape should the image be ? Frequency axis should be gone.
896 + // and Stokes length 1
897 + const auto shape0 = ImagePolarimetry::shape();
898 + IPosition shape(shape0.size()-1);
899 + Int j = 0;
900 + for (Int i=0; i<Int(shape0.size()); ++i) {
901 + if (i == sAxis) {
902 + shape[j] = 1;
903 + ++j;
922 904 }
923 - }
924 - }
925 -//
926 - return shape;
905 + else {
906 + if (i != fAxis) {
907 + shape[j] = shape0[i];
908 + ++j;
909 + }
910 + }
911 + }
912 + return shape;
927 913 }
928 914
929 -
930 915 ImageExpr<Float> ImagePolarimetry::stokesI() const
931 916 {
932 917 return _makeStokesExpr(_stokes[ImagePolarimetry::I], Stokes::I, String("StokesI"));
933 918 }
934 919
935 920 Float ImagePolarimetry::sigmaStokesI(Float clip)
936 921 {
937 922 return _sigma(ImagePolarimetry::I, clip);
938 923 }
939 924

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut