Skip to content

Instantly share code, notes, and snippets.

View thomasaarholt's full-sized avatar

Thomas Aarholt thomasaarholt

View GitHub Profile
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-4-f890f17f75fd> in <module>()
----> 1 s.align_zero_loss_peak()
C:\ProgramData\Miniconda3\lib\site-packages\hyperspy\_signals\eels.py in align_zero_loss_peak(self, calibrate, also_align, print_stats, subpixel, mask, signal_range, show_progressbar, **kwargs)
287
288 zlpc = estimate_zero_loss_peak_centre(self, mask, signal_range)
--> 289 mean_ = without_nans(zlpc.data).mean()
290 if print_stats is True:
---------------------------------------------------------------------------
TraitError Traceback (most recent call last)
<ipython-input-88-3fc0a0685cf7> in <module>()
----> 1 img, s = hs.load("8.bcf")
C:\ProgramData\Miniconda3\envs\35\lib\site-packages\hyperspy\io.py in load(filenames, signal_type, stack, stack_axis, new_axis_name, lazy, **kwds)
241 objects = [load_single_file(filename, lazy=lazy,
242 **kwds)
--> 243 for filename in filenames]
244
@thomasaarholt
thomasaarholt / fftw.py
Created September 27, 2017 13:32
fftw prime determiner
def check_if_number_is_fftw_prime(numb):
import sympy
factors = sympy.ntheory.factorint(numb)
if len(factors) > 5:
return False
primes = factors.keys()
if max(primes) > 13:
return False
n11 = 0
n13 = 0
@thomasaarholt
thomasaarholt / pyprismatic_install_error.shell
Created November 13, 2017 13:26
Error when installing pyprismatic on windows
λ pip install pyprismatic
Collecting pyprismatic
Using cached PyPrismatic-1.1.15.tar.gz
Collecting numpy>=1.13.0 (from pyprismatic)
Using cached numpy-1.13.3-cp35-none-win_amd64.whl
Collecting matplotlib>=2.0.2 (from pyprismatic)
Using cached matplotlib-2.1.0-cp35-cp35m-win_amd64.whl
Requirement already satisfied: pytz in c:\programdata\miniconda3\lib\site-packages (from matplotlib>=2.0.2->pyprismatic)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\programdata\miniconda3\lib\site-packages (from matplotlib>=2.0.2->pyprismatic)
Requirement already satisfied: python-dateutil>=2.0 in c:\programdata\miniconda3\lib\site-packages (from matplotlib>=2.0.2->pyprismatic)
@thomasaarholt
thomasaarholt / cuprismatic_crash.bash
Last active November 16, 2017 12:35
Result after cuprismatic crashing when only running on GPU
[I 13:34:12.255 NotebookApp] Adapting to protocol v5.1 for kernel 879c9343-88fe-43f2-a9d7-9416223907b7
COMPILED FOR GPU
Simulation parameters:
=====================
@thomasaarholt
thomasaarholt / ase_to_prismatic_writer.py
Created November 16, 2017 15:14
Python writer to create XYZ samples from ASE atoms objects
def save_cell_for_prismatic(sample, name, path=""):
"Auto-adds 'prismatic' to filename"
import os
import numpy as np
if path == "":
path = os.getcwd()
name += "_Prismatic"
total = np.zeros(len(sample.numbers), dtype=[('Z', 'int8'), ("x", 'float'), ("y", 'float'), ("z", 'float'), ('occ', 'int'), ('dw', 'float')])
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-18-0e1e17072b32> in <module>()
----> 1 SED, SI = acquirer.start()
2 #plt.imshow(a)
<ipython-input-16-abe1af516896> in start(self)
197 '''
198 #SE = self.acquire_large_SE_image()
--> 199 SED, SI = self.acquire_cube()
sem = model.getComponent(name="SEM Detector")
spec = model.getComponent(name="UV Spectrometer")
stream = SEMSpectrumMDStream("test", sem, spec)
---------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-173-dab28defdbf6> in <module>()
1 sem = model.getComponent(name="SEM Detector")
2 spec = model.getComponent(name="UV Spectrometer")
----> 3 stream = SEMSpectrumMDStream("thomas", sem, spec)
---------------------------------------------------------------
ConnectionClosedError Traceback (most recent call last)
<ipython-input-16-248a991767f8> in <module>()
----> 1 SE, SI = acquirer.start()
/home/sparc/development/notebooks_thomas/tools_acquire.py in start(self)
252 '''
253 #SE = self.acquire_large_SE_image()
--> 254 SED, SI = self.acquire_cube()
255 return SED, SI
### The intention is to create a script that acquires both from the secondary electron detector
### and the CL detector (UV spectrometer) whilst scanning over a rectangular grid on the sample.
# In order to define the various streams, I import the following
from odemis.acq.stream import SEMStream, CameraStream, SEMMDStream
from odemis import model
escan = model.getComponent(name="SEM E-beam")
sed = model.getComponent(name="SEM Detector")
spec = model.getComponent(name="UV Spectrometer")