This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hyperspy.api as hs | |
%matplotlib qt4 | |
s = hs.load("EELS 0eV.dm3") | |
s.plot() # This works! | |
import traitsui | |
traitsui.__version__ | |
'5.0.0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
ValueError Traceback (most recent call last) | |
<ipython-input-1-efe73691b2de> in <module>() | |
2 matplotlib.use("Qt4Agg") | |
3 | |
----> 4 import hyperspy.api as hs | |
5 | |
6 get_ipython().magic(u'matplotlib') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) | |
/Users/thomas/anaconda/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs) | |
57 def draw_wrapper(artist, renderer, *args, **kwargs): | |
58 before(artist, renderer) | |
---> 59 draw(artist, renderer, *args, **kwargs) | |
60 after(artist, renderer) | |
61 | |
/Users/thomas/anaconda/lib/python2.7/site-packages/matplotlib/figure.pyc in draw(self, renderer) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
ImportError Traceback (most recent call last) | |
<ipython-input-1-5084803b0409> in <module>() | |
----> 1 import hyperspy.api as hs | |
2 | |
3 path = "/Users/thomas/Dropbox/0_DPhil/0_Data/00_TEM Data/0_Other/Test/Image" | |
4 name = "EELS Metal 0eV" | |
5 | |
/Users/thomas/anaconda/envs/c3/lib/python3.5/site-packages/hyperspy/api.py in <module>() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hyperspy.api as hs | |
s = hs.load("MO") | |
# Get peak energy | |
Zr_Peak = 330. | |
O_peak = 532. | |
# Create signals with enough background and signal length to fit the components. | |
s_Zr = s.isig[Zr_Peak - 40.:Zr_Peak + 60.] | |
s_O = s.isig[O_peak - 40.:O_peak + 60.] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------------------- | |
OSError Traceback (most recent call last) | |
<ipython-input-14-240ac4daefae> in <module>() | |
1 spectra[0].save("test2.hdf5") | |
----> 2 abc = hs.load("test2.hdf5") | |
/Users/thomas/Dropbox/0_Git/GitHub Desktop/hyperspy/hyperspy/io.py in load(filenames, record_by, signal_type, signal_origin, stack, stack_axis, new_axis_name, mmap, mmap_dir, **kwds) | |
212 objects = [load_single_file(filename, | |
213 **kwds) | |
--> 214 for filename in filenames] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> %matplotlib | |
RuntimeError Traceback (most recent call last) | |
<ipython-input-3-fc39d5fd4eba> in <module>() | |
----> 1 get_ipython().magic('matplotlib') | |
C:\Users\EMGroup\AppData\Local\HyperSpy WinPython Bundle 0.8.4\python-3.4.4.amd64\lib\site-packages\IPython\core\interactiveshell.py in magic(self, arg_s) | |
2161 magic_name, _, magic_arg_s = arg_s.partition(' ') | |
2162 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC) | |
-> 2163 return self.run_line_magic(magic_name, magic_arg_s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def median_from_neighbors(energy_slice, x, y=""): | |
"""Takes the median of the value of the list neighbors""" | |
import numpy as np | |
return(np.median(find_cell_neighbors(energy_slice, x,y))) | |
def find_cell_neighbors(data, X, Y, r=1): | |
"""Finds value of neighbors of a index in the SI, excluding the centre and any values outside the edges of the SI""" | |
adjacent = [] | |
if Y == "": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mybin(s, xbin=1, ybin=1, sbin=1): | |
"""Return spectrum s binned by factors xbin, ybin, sbin""" | |
if (xbin < 1) or (ybin < 1) or (sbin < 1): | |
raise ValueError("One of your binnings is smaller than 1. For signal axis to remain constant, leave as 1") | |
if all(n==1 for n in (xbin, ybin, sbin)): | |
print("Not binning because all binnings == 1") | |
return s # End Early | |
# Get signal channels |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SI_dispersion = check_energy_dispersion(bss_spectra[0]) | |
bin_mlls = False | |
bin_factor = 1 | |
for s in mlls_objects: | |
mlls_dispersion = check_energy_dispersion(s) | |
if SI_dispersion > mlls_dispersion: | |
bin_mlls = True | |
if SI_dispersion / mlls_dispersion > bin_factor: | |
bin_factor = int(SI_dispersion / mlls_dispersion) | |
print(bin_factor) |
OlderNewer