Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 24, 2024
1 parent 7eb8516 commit f6b9651
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
18 changes: 9 additions & 9 deletions src/pyFAI/integrator/fiber.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def tilt_angle(self):
@property
def sample_orientation(self):
return self._cache_parameters.get('sample_orientation', 1)

def parse_units(self, unit_ip, unit_oop, incident_angle=None, tilt_angle=None, sample_orientation=None):
if unit_ip is None:
unit_ip = units.get_unit_fiber("qip_nm^-1")
Expand Down Expand Up @@ -175,7 +175,7 @@ def integrate_fiber(self, data,

unit_ip, unit_oop = self.parse_units(unit_ip=unit_ip, unit_oop=unit_oop,
sample_orientation=sample_orientation)

self.reset_integrator(incident_angle=unit_ip.incident_angle,
tilt_angle=unit_ip.tilt_angle,
sample_orientation=unit_ip.sample_orientation)
Expand Down Expand Up @@ -243,7 +243,7 @@ def integrate_fiber(self, data,

return result

def integrate_grazing_incidence(self, data,
def integrate_grazing_incidence(self, data,
npt_ip, ip_range=None, unit_ip=None,
npt_oop=1000, oop_range=None, unit_oop=None,
vertical_integration = True,
Expand Down Expand Up @@ -296,11 +296,11 @@ def integrate_grazing_incidence(self, data,
incident_angle=incident_angle,
tilt_angle=tilt_angle,
sample_orientation=sample_orientation)

self.reset_integrator(incident_angle=unit_ip.incident_angle,
tilt_angle=unit_ip.tilt_angle,
sample_orientation=unit_ip.sample_orientation)

return self.integrate_fiber(data=data,
npt_oop=npt_oop, unit_oop=unit_oop, oop_range=oop_range,
npt_ip=npt_ip, unit_ip=unit_ip, ip_range=ip_range,
Expand All @@ -312,7 +312,7 @@ def integrate_grazing_incidence(self, data,
polarization_factor=polarization_factor, dark=dark, flat=flat,
method=method,
normalization_factor=normalization_factor)


def integrate2d_fiber(self, data,
npt_ip=1000, unit_ip=None, ip_range=None,
Expand Down Expand Up @@ -346,11 +346,11 @@ def integrate2d_fiber(self, data,

unit_ip, unit_oop = self.parse_units(unit_ip=unit_ip, unit_oop=unit_oop,
sample_orientation=sample_orientation)

self.reset_integrator(incident_angle=unit_ip.incident_angle,
tilt_angle=unit_ip.tilt_angle,
sample_orientation=unit_ip.sample_orientation)

if (isinstance(method, (tuple, list)) and method[0] != "no") or (isinstance(method, IntegrationMethod) and method.split != "no"):
logger.warning(f"Method {method} is using a pixel-splitting scheme. GI integration should be use WITHOUT PIXEL-SPLITTING! The results could be wrong!")

Expand Down Expand Up @@ -401,7 +401,7 @@ def integrate2d_grazing_incidence(self, data,
incident_angle=incident_angle,
tilt_angle=tilt_angle,
sample_orientation=sample_orientation)

self.reset_integrator(incident_angle=unit_ip.incident_angle,
tilt_angle=unit_ip.tilt_angle,
sample_orientation=unit_ip.sample_orientation)
Expand Down
6 changes: 2 additions & 4 deletions src/pyFAI/test/test_fiber_integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_integrate1d_grazing_parameters(self):
tilt_angle=tilt_angle,
sample_orientation=sample_orientation,
)

res1d_string_units = self.fi.integrate_grazing_incidence(data=self.data, npt_ip=npt_ip,
unit_ip="qip_nm^-1", unit_oop="qoop_nm^-1",
incident_angle=incident_angle,
Expand All @@ -182,7 +182,7 @@ def test_integrate1d_grazing_parameters(self):

self.assertEqual(abs(res1d_ref.radial - res1d_fiber_units.radial).max(), 0)
self.assertEqual(abs(res1d_ref.intensity - res1d_fiber_units.intensity).max(), 0)


# def test_integrate1d_priority(self):
npt_ip = 500
Expand Down Expand Up @@ -218,5 +218,3 @@ def test_integrate1d_grazing_parameters(self):

self.assertFalse(abs(res1d_ref.radial - res1d_wrong.radial).max(), 0)
self.assertFalse(abs(res1d_ref.intensity - res1d_wrong.intensity).max(), 0)


4 changes: 2 additions & 2 deletions src/pyFAI/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ def __init__(self, name, scale=1, label=None, equation=None, formula=None,

def __repr__(self):
return f"""
{self.name}
{self.name}
Incident_angle={self.incident_angle}\u00b0
Tilt_angle={self.tilt_angle}\u00b0
Sample orientation={self.sample_orientation}
"""

@property
def incident_angle(self):
return self._incident_angle
Expand Down

0 comments on commit f6b9651

Please sign in to comment.