pyxem / pyxem-demos

Examples and tutorials of multi-dimensional diffraction microscopy workflows using pyxem.
30 stars 38 forks source link

demos errors signal2D has no attribute #48

Closed winston-song closed 3 years ago

winston-song commented 3 years ago

dp = pxm.load_hspy('./data/01/twinned_nanowire.hdf5') dp.set_microscope_parameters(beam_energy=300.0, camera_length=21.0, scan_rotation=277.0, convergence_angle=0.7, exposure_time=10.0)


AttributeError Traceback (most recent call last)

in ----> 1 dp.set_microscope_parameters(beam_energy=300.0, 2 camera_length=21.0, 3 scan_rotation=277.0, 4 convergence_angle=0.7, 5 exposure_time=10.0) AttributeError: 'Signal2D' object has no attribute 'set_microscope_parameters' data = pxm.load_hspy("./data/09/PdNiP_test.hspy") data.set_signal_type("electron_diffraction") data.beam_energy=200 data.unit = "k_nm^-1" rad = data.get_azimuthal_integral2d(npt_rad=100, center=(31.77734804, 31.23438963)) --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in 2 data.beam_energy=200 3 data.unit = "k_nm^-1" ----> 4 rad = data.get_azimuthal_integral2d(npt_rad=100, center=(31.77734804, 31.23438963)) AttributeError: 'Signal2D' object has no attribute 'get_azimuthal_integral2d'
hakonanes commented 3 years ago

~Apparently your signal became a Signal2D at some point, which doesn't have that class method? From notebook 1 it seems that you must use dp.set_signal_type("electron_diffraction")? I guess more active pyxem users can give you the answer if this doesn't work.~

Edit: see @pc494 answer below.

pc494 commented 3 years ago

Hi there,

In the short term these can be fixed by add the line

data = pxm.ElectronDiffraction2D(data)

after loading. The 0.12 series (which I presume you are running) has some issues with io that should be fixed in our next release.