rosalindfranklininstitute / parakeet

Phantom generator
GNU General Public License v3.0
17 stars 5 forks source link

Error in parakeet.simulate.exit_wave (AttributeError: 'multem_ext.Input' object has no attribute 'cond_lens_si_sigma') #20

Closed DimitriosBellos closed 2 years ago

DimitriosBellos commented 2 years ago

After executing parakeet.simulate.exit_wave -c config_new.yaml The following error is printed (the confignew.yaml and sample.h5 are in the attached zip file) [Config&Sample.zip](https://github.com/rosalindfranklininstitute/amplus-digital-twin/files/7617266/Config._Sample.zip) :

microscope:
    beam:
        electrons_per_angstrom: 15.5
    detector:
        nx: 1000
        ny: 1000
        origin:
        - 0
        - 0
    model: krios
    objective_lens:
        c_10: -25000
sample:
    box:
    - 1000
    - 1200
    - 1000
    centre:
    - 500
    - 600
    - 500
    coords:
        orientation:
        - 0
        - 0
        - 0
    molecules:
        6z6u:
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
        -   orientation:
            - 0
            - 0
            - 0
    shape:
        cylinder:
            length: 1000
            radius: 500
        margin:
        - 0
        - 0
        - 0
        type: cylinder
scan:
    axis:
    - 0
    - 1
    - 0
    mode: tilt_series
    num_images: 360
    start_angle: -90
    start_pos: 100
    step_angle: 1
simulation:
    division_thickness: 1000
    ice: true
    inelastic_model: zero_loss
    slice_thickness: 5

Loading sample from sample.h5
Opening file: exit_wave.h5
    Running job: 1/360 for -90 degrees
Simulating image 1
Simulating using device
Traceback (most recent call last):
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/bin/parakeet.simulate.exit_wave", line 8, in <module>
    sys.exit(exit_wave())
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/lib/python3.9/site-packages/parakeet/command_line/simulate.py", line 257, in exit_wave
    simulation.run(writer)
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/lib/python3.9/site-packages/parakeet/simulation.py", line 285, in run
    _, angle, position, image, drift, defocus = self.simulate_image(i)
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/lib/python3.9/site-packages/parakeet/simulation.py", line 636, in __call__
    input_multislice = create_input_multislice(
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/lib/python3.9/site-packages/parakeet/simulation.py", line 158, in create_input_multislice
    input_multislice.cond_lens_si_sigma = ssf_sigma
AttributeError: 'multem_ext.Input' object has no attribute 'cond_lens_si_sigma'
jmp1985 commented 2 years ago

Hi Dimitrios

This is a result of upgrading some stuff in python-multem. I have created new releases for python-multem, guanaco and parakeet so hopefully everything is fully in sync again! Try updating all the repositories and then let me know if you have any more issues.

DimitriosBellos commented 2 years ago

OK. I updated and tested everything (the whole pipeline from sample.new -> analyse.reconstruct). Everything (almost everything) works OK. The only thing that I spotted not working is:

parakeet.export corrected_optics.mrc -o corrected_optics.h5
Reading data from corrected_optics.mrc
Traceback (most recent call last):
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/envs/parakeet/bin/parakeet.export", line 8, in <module>
    sys.exit(export())
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/envs/parakeet/lib/python3.9/site-packages/parakeet/command_line/__init__.py", line 232, in export
    reader = parakeet.io.open(args.filename)
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/envs/parakeet/lib/python3.9/site-packages/parakeet/io.py", line 786, in open
    return Reader.from_file(filename)
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/envs/parakeet/lib/python3.9/site-packages/parakeet/io.py", line 744, in from_file
    return Class.from_mrcfile(filename)
  File "/home/0000-0002-8015-3191/workspace-ceph/Installations/miniconda3/envs/parakeet/lib/python3.9/site-packages/parakeet/io.py", line 640, in from_mrcfile
    assert handle.extended_header.shape[0] == handle.data.shape[0]
AssertionError

So the .mrc created by the parakeet.analyse.correct is not able to be export to h5 using parakeet.export

Furthermore I wasn’t able to upgrade using python -m pip install git+https://github.com/rosalindfranklininstitute/amplus-digital-twin.git@master --upgrade The functions still didn’t work, but I after installing to a fresh virtual environment everything worked except of course from the: parakeet.export corrected_optics.mrc -o corrected_optics.h5

jmp1985 commented 2 years ago

Hi Dimitrios

I'm glad to hear that things are working. The export to HDF5 is not currently supported for the corrected file because it has 4D data and I haven't implemented how to handle the meta data properly for that case. I will add a new issue with just that feature.