Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
If True, only fit the background at the current coordinates.
Default True.
**kwargs : extra key word arguments
All extra key word arguments are passed to fit or
multifit.
"""
# If there is no active background compenent do nothing
if not self._active_background_components:
return
iee = self._get_first_ionization_edge_energy(start_energy=start_energy)
if iee is not None:
to_disable = [edge for edge in self._active_edges
if edge.onset_energy.value >= iee]
E2 = iee - preferences.EELS.preedge_safe_window_width
self.disable_edges(to_disable)
else:
E2 = None
self.set_signal_range(start_energy, E2)
if only_current:
self.fit(**kwargs)
else:
self.multifit(**kwargs)
self.channel_switches = copy.copy(self.backup_channel_switches)
if iee is not None:
self.enable_edges(to_disable)
mmap=mmap, mmap_dir=mmap_dir)
signal.metadata.General.title = \
os.path.split(
os.path.split(
os.path.abspath(filenames[0])
)[0]
)[1]
messages.information('Individual files loaded correctly')
signal._print_summary()
objects = [signal, ]
else:
objects = [load_single_file(filename,
**kwds)
for filename in filenames]
if hyperspy.defaults_parser.preferences.Plot.plot_on_load:
for obj in objects:
obj.plot()
if len(objects) == 1:
objects = objects[0]
return objects
def readgosfile(self):
print "\nHartree-Slater GOS"
print "\tElement: ", self.element
print "\tSubshell: ", self.subshell
print "\tOnset Energy = ", self.onset_energy
element = self.element
subshell = self.subshell
filename = os.path.join(
preferences.EELS.eels_gos_files_path,
elements[element]['Atomic_properties']['Binding_energies'][subshell]['filename'])
with open(filename) as f:
GOS_list = f.read().replace('\r', '').split()
# Map the parameters
material = GOS_list[0]
info1_1 = float(GOS_list[2])
info1_2 = float(GOS_list[3])
info1_3 = float(GOS_list[4])
ncol = int(GOS_list[5])
info2_1 = float(GOS_list[6])
info2_2 = float(GOS_list[7])
nrow = int(GOS_list[8])
self.gos_array = np.array(GOS_list[9:], dtype=np.float64)
# The division by R is not in the equations, but it seems that
def _plot_loadings(self, loadings, comp_ids=None, calibrate=True,
same_window=None, comp_label=None,
with_factors=False, factors=None,
cmap=plt.cm.gray, no_nans=False, per_row=3):
if same_window is None:
same_window = preferences.MachineLearning.same_window
if comp_ids is None:
comp_ids=xrange(loadings.shape[0])
elif not hasattr(comp_ids,'__iter__'):
comp_ids=xrange(comp_ids)
n=len(comp_ids)
if same_window:
rows=int(np.ceil(n/float(per_row)))
fig_list=[]
if n
from hyperspy.api_nogui import *
import logging
_logger = logging.getLogger(__name__)
__doc__ = hyperspy.api_nogui.__doc__
try:
# Register ipywidgets by importing the module
import hyperspy_gui_ipywidgets
except ImportError:
from hyperspy.defaults_parser import preferences
if preferences.GUIs.warn_if_guis_are_missing:
_logger.warning(
"The ipywidgets GUI elements are not available, probably because the "
"hyperspy_gui_ipywidgets package is not installed.")
try:
# Register traitui UI elements by importing the module
import hyperspy_gui_traitsui
except ImportError:
from hyperspy.defaults_parser import preferences
if preferences.GUIs.warn_if_guis_are_missing:
_logger.warning(
"The traitsui GUI elements are not available, probably because the "
"hyperspy_gui_traitsui package is not installed.")
def _set_default_param(self):
"""Set to value to default (defined in preferences)
"""
mp = self.metadata
if "Acquisition_instrument.SEM.tilt_stage" not in mp:
mp.set_item(
"Acquisition_instrument.SEM.tilt_stage",
preferences.EDS.eds_tilt_stage)
if "Acquisition_instrument.SEM.Detector.EDS.elevation_angle" not in mp:
mp.set_item(
"Acquisition_instrument.SEM.Detector.EDS.elevation_angle",
preferences.EDS.eds_detector_elevation)
if "Acquisition_instrument.SEM.Detector.EDS.energy_resolution_MnKa" \
not in mp:
mp.set_item(
"Acquisition_instrument.SEM.Detector.EDS."
"energy_resolution_MnKa",
preferences.EDS.eds_mn_ka)
if "Acquisition_instrument.SEM.Detector.EDS.azimuth_angle" not in mp:
mp.set_item(
"Acquisition_instrument.SEM.Detector.EDS.azimuth_angle",
preferences.EDS.eds_detector_azimuth)