pyxem / pyxem-demos

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

03 Reference Standards - 2. Determine Lens Distortions #68

Open que-vector opened 3 years ago

que-vector commented 3 years ago

Hi, I am trying to work through section 2 in example notebook 3 in version 0.13.2. but I am getting this AttributeError, see below. Could you please help me to solve this?

Thanks!


In [9]: cal.get_elliptical_distortion(mask_radius=10, scale=100, amplitude=1000, asymmetry=0.9,spread=2)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-27e3dbe10698> in <module>
----> 1 cal.get_elliptical_distortion(mask_radius=10,
      2                               scale=100, amplitude=1000,
      3                               asymmetry=0.9,spread=2)

D:\Python\Anaconda\envs\pyxem\lib\site-packages\pyxem\generators\calibration_generator.py in get_elliptical_distortion(self, mask_radius, scale, amplitude, spread, direct_beam_amplitude, asymmetry, rotation, center)
    167             )
    168         standard_dp = self.diffraction_pattern
--> 169         image_size = standard_dp.data.shape[0]
    170         if center is None:
    171             center = [(image_size - 1) / 2, (image_size - 1) / 2]

AttributeError: 'CalibrationDataLibrary' object has no attribute 'data'
pc494 commented 3 years ago

Hi,

Sorry about the delay on getting back to you. It seems this demo is still running on 0.12, in the version you are using the generator is initialised with diffraction_pattern. So the line:

cal_lib = CalibrationDataLibrary(au_x_grating_dp=au_dpeg,
                                 au_x_grating_im=au_im,
                                 moo3_dp=moo3_dpeg,
                                 moo3_im=moo3_im)

Will need adjusting (probably by replacing au_x_gratingwith diffraction_pattern)