From bccd06cfc96a7ac3a278789cb1d94621fcb042b2 Mon Sep 17 00:00:00 2001 From: Sophie Reed Date: Thu, 20 Apr 2023 15:59:23 -0700 Subject: [PATCH] Fix flake 8 issues --- .../tools/actions/plot/colorColorFitPlot.py | 12 +++++--- .../actions/plot/scatterplotWithTwoHists.py | 3 +- .../tools/actions/vector/ellipticity.py | 28 +++++++++++++------ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/python/lsst/analysis/tools/actions/plot/colorColorFitPlot.py b/python/lsst/analysis/tools/actions/plot/colorColorFitPlot.py index 292321e13..0c84b9eee 100644 --- a/python/lsst/analysis/tools/actions/plot/colorColorFitPlot.py +++ b/python/lsst/analysis/tools/actions/plot/colorColorFitPlot.py @@ -119,7 +119,8 @@ def makePlot( The data to plot the points from, for more information please see the notes section. plotInfo : `dict` - A dictionary of information about the data being plotted with keys: + A dictionary of information about the data being plotted + with keys: * ``"run"`` The output run for the plots (`str`). @@ -188,9 +189,11 @@ def makePlot( The gradient of the line perpendicular to the line from the second ODR fit. * ``"bPerpMin"`` - The intercept of the perpendicular line that goes through xMin. + The intercept of the perpendicular line that goes through + xMin. * ``"bPerpMax"`` - The intercept of the perpendicular line that goes through xMax. + The intercept of the perpendicular line that goes through + xMax. * The main inputs to plot: x, y, mag @@ -202,7 +205,8 @@ def makePlot( .. image:: /_static/analysis_tools/stellarLocusExample.png For a detailed example of how to make a plot from the command line - please see the :ref:`getting started guide`. + please see the + :ref:`getting started guide`. """ # Define a new colormap diff --git a/python/lsst/analysis/tools/actions/plot/scatterplotWithTwoHists.py b/python/lsst/analysis/tools/actions/plot/scatterplotWithTwoHists.py index 636e1bbe6..0df30da80 100644 --- a/python/lsst/analysis/tools/actions/plot/scatterplotWithTwoHists.py +++ b/python/lsst/analysis/tools/actions/plot/scatterplotWithTwoHists.py @@ -316,7 +316,8 @@ def makePlot( .. image:: /_static/analysis_tools/scatterPlotExample.png For a detailed example of how to make a plot from the command line - please see the :ref:`getting started guide`. + please see the + :ref:`getting started guide`. """ if not self.plotTypes: noDataFig = Figure() diff --git a/python/lsst/analysis/tools/actions/vector/ellipticity.py b/python/lsst/analysis/tools/actions/vector/ellipticity.py index 1b78fc7cb..06cb108d7 100644 --- a/python/lsst/analysis/tools/actions/vector/ellipticity.py +++ b/python/lsst/analysis/tools/actions/vector/ellipticity.py @@ -35,17 +35,24 @@ class CalcE(VectorAction): - """Calculate a complex value representation of the ellipticity. + r"""Calculate a complex value representation of the ellipticity. The complex ellipticity is typically defined as - :math:`e = |e|\exp{(j*2*theta)} = \\frac{((Ixx - Iyy) + j*(2*Ixy))}{(Ixx + Iyy)}`, where j is - the square root of -1 and Ixx, Iyy, Ixy are second-order central moments. - This is sometimes referred to as distortion, and denoted by e = (e1, e2) - in GalSim (see Eq. 4.4. of Bartelmann and Schneider, 2001). + .. math:: + + e = |e|\exp{(j*2*theta)} + e = \\frac{((Ixx - Iyy) + j*(2*Ixy))}{(Ixx + Iyy)}, + + where j is the square root of -1 and Ixx, Iyy, Ixy are second-order + central moments. This is sometimes referred to as distortion, and denoted + by e = (e1, e2) in GalSim (see Eq. 4.4. of Bartelmann and Schneider, 2001). The other definition differs in normalization. It is referred to as shear, and denoted by g = (g1, g2) in GalSim (see Eq. 4.10 of Bartelmann and Schneider (2001). It is defined - as :math:`g = \\frac{((Ixx - Iyy) + j*(2*Ixy))}{(Ixx + Iyy + 2\sqrt{(Ixx*Iyy - Ixy^{2})})}`. + as + .. math:: + + g = \\frac{((Ixx-Iyy)+j*(2*Ixy))}{(Ixx+Iyy+2\sqrt{(Ixx*Iyy-Ixy^{2})})}. The shear measure is unbiased in weak-lensing shear, but may exclude some objects in the presence of noisy moment estimates. The distortion measure @@ -145,7 +152,7 @@ def __call__(self, data: KeyedData, **kwargs) -> Vector: class CalcEDiff(VectorAction): - """Calculate the difference of two ellipticities as a complex quantity. + r"""Calculate the difference of two ellipticities as a complex quantity. The complex ellipticity difference between e_A and e_B is defined as :math:`e_{A} - e_{B} = de = |de|\exp{(j*2*theta)}`. @@ -160,7 +167,10 @@ class CalcEDiff(VectorAction): 1. This is a shape measurement used for doing QA on the ellipticity of the sources. - 2. For plotting purposes we might want to plot :math:`|de|*\exp{(j*theta)}`. + 2. For plotting purposes we might want to plot + + .. math:: |de|*\exp{(j*theta)}. + If `halvePhaseAngle` config parameter is set to `True`, then the returned quantity therefore corresponds to :math:`|e|*\exp{(j*theta)}`. """ @@ -291,7 +301,7 @@ def validate(self): class CalcE2(VectorAction): - """Calculate distortion-type :math:`e2 = 2Ixy/(Ixx+Iyy)` or + r"""Calculate distortion-type :math:`e2 = 2Ixy/(Ixx+Iyy)` or shear-type :math:`g2 = 2Ixy/(Ixx+Iyy+2\sqrt(Ixx*Iyy - Ixy^{2}))`. See Also