Skip to content

Commit

Permalink
autoformats
Browse files Browse the repository at this point in the history
  • Loading branch information
bsavitzky committed Oct 16, 2023
1 parent 486639f commit 5013d3e
Showing 1 changed file with 22 additions and 37 deletions.
59 changes: 22 additions & 37 deletions py4DSTEM/process/polar/polar_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ def calculate_radial_statistics(
returnfig=True,
)
if returnfig:
ans.append((fig,ax))
ans.append((fig, ax))
if plot_results_var:
fig, ax = plot_radial_var_norm(
self,
figsize=figsize,
returnfig=True,
)
if returnfig:
ans.append((fig,ax))
ans.append((fig, ax))

# return
return ans
Expand Down Expand Up @@ -342,8 +342,8 @@ def calculate_pair_dist_function(
coefs[3] *= int_mean

# Calculate the mean atomic form factor without a constant offset
#coefs_fk = (0.0, coefs[1], coefs[2], coefs[3], coefs[4])
#fk = scattering_model(k2, coefs_fk)
# coefs_fk = (0.0, coefs[1], coefs[2], coefs[3], coefs[4])
# fk = scattering_model(k2, coefs_fk)
bg = scattering_model(k2, coefs)
fk = bg - coefs[0]

Expand Down Expand Up @@ -419,7 +419,6 @@ def calculate_pair_dist_function(
# store results
self.pdf = pdf


# prepare answer
if density is None:
return_values = self.pdf_r, self.pdf_reduced
Expand All @@ -430,39 +429,26 @@ def calculate_pair_dist_function(
else:
ans = None if not returnfig else []


# Plots
if plot_background_fits:
fig,ax = self.plot_background_fits(
figsize = figsize,
returnfig = True
)
fig, ax = self.plot_background_fits(figsize=figsize, returnfig=True)
if returnfig:
ans.append((fig,ax))
ans.append((fig, ax))

if plot_sf_estimate:
fig,ax = self.plot_sf_estimate(
figsize = figsize,
returnfig = True
)
fig, ax = self.plot_sf_estimate(figsize=figsize, returnfig=True)
if returnfig:
ans.append((fig,ax))
ans.append((fig, ax))

if plot_reduced_pdf:
fig,ax = self.plot_reduced_pdf(
figsize = figsize,
returnfig = True
)
fig, ax = self.plot_reduced_pdf(figsize=figsize, returnfig=True)
if returnfig:
ans.append((fig,ax))
ans.append((fig, ax))

if plot_pdf:
fig,ax = self.plot_pdf(
figsize = figsize,
returnfig = True
)
fig, ax = self.plot_pdf(figsize=figsize, returnfig=True)
if returnfig:
ans.append((fig,ax))
ans.append((fig, ax))

# return
return ans
Expand All @@ -472,7 +458,7 @@ def plot_background_fits(
self,
figsize=(8, 4),
returnfig=False,
):
):
"""
TODO
"""
Expand Down Expand Up @@ -500,14 +486,15 @@ def plot_background_fits(
)
ax.set_yscale("log")
if returnfig:
return fig,ax
return fig, ax
plt.show()


def plot_sf_estimate(
self,
figsize=(8, 4),
returnfig=False,
):
):
"""
TODO
"""
Expand All @@ -527,15 +514,15 @@ def plot_sf_estimate(
ax.set_xlabel("Scattering Vector [A^-1]")
ax.set_ylabel("Reduced Structure Factor")
if returnfig:
return fig,ax
return fig, ax
plt.show()


def plot_reduced_pdf(
self,
figsize=(8, 4),
returnfig=False,
):
):
"""
TODO
"""
Expand All @@ -548,14 +535,15 @@ def plot_reduced_pdf(
ax.set_xlabel("Radius [A]")
ax.set_ylabel("Reduced Pair Distribution Function")
if returnfig:
return fig,ax
return fig, ax
plt.show()


def plot_pdf(
self,
figsize=(8, 4),
returnfig=False,
):
):
"""
TODO
"""
Expand All @@ -568,11 +556,9 @@ def plot_pdf(
ax.set_xlabel("Radius [A]")
ax.set_ylabel("Pair Distribution Function")
if returnfig:
return fig,ax
return fig, ax
plt.show()



# functions for inverting from reduced PDF back to S(k)

# # invert
Expand Down Expand Up @@ -653,4 +639,3 @@ def scattering_model(k2, *coefs):
# int1*np.exp(k2/(-2*sigma1**2))

return int_model

0 comments on commit 5013d3e

Please sign in to comment.