Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions hexrd/wppf/WPPF.py
Original file line number Diff line number Diff line change
Expand Up @@ -1573,18 +1573,28 @@ def _set_params_vals_to_class(self, params, init=False, skip_phases=False):
self.amorphous_model.center = center
self.amorphous_model.fwhm = fwhm

@property
def total_area(self):
tth, intensity = self.spectrum_sim.data
_, background = self.background.data
total_intensity = intensity-background
'''put some guard rails around the total intensity
to protect against nans in the values
'''
mask = np.isnan(total_intensity)
sum_area = np.trapz(total_intensity[~mask], tth[~mask])
return sum_area


@property
def DOC(self):
if self.amorphous_model is None:
return 1.
else:
tth, intensity = self.spectrum_sim.data
_, background = self.background.data
total_intensity = intensity-background
amorphous_area = \
self.amorphous_model.integrated_area
return 1. - amorphous_area/np.trapz(
total_intensity, tth)
total_area = self.total_area
return 1. - amorphous_area/total_area


def _nm(x):
Expand Down
2 changes: 1 addition & 1 deletion hexrd/wppf/amorphous.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ def fwhm(self, val):
def amorphous_lineout(self):
if self.model_type == "experimental":

lo = np.zeros_like(self.tth_list)
for key in self.shift:
lo = np.zeros_like(self.tth_list)
smooth_model_data = gaussian_filter(
self.model_data[key],
self.smoothing
Expand Down
Loading