Dear list,
I've found a strange behavior working with EMAN2Ctf.
If I try to load CTF parameters from a dictionary in a for loop it fails with the exception:
Traceback (most recent call last):
File "reproduce.py", line 17, in <module>
for value in range(3):
IndexError: list index out of range
This is my EMAN2 Version:
EMAN 2.21a final (GITHUB: 2018-02-14 08:53 - commit: None )
Your EMAN2 is running on: Linux-4.15.0-43-generic-x86_64-with-debian-buster-sid 4.15.0-43-generic
Your Python version is: 2.7.13
Here is the script to produce the problem:
import EMAN2
current_ctf = EMAN2.EMAN2Ctf()
# Runs
for value in range(1):
ctf_parameter = EMAN2.EMAN2Ctf(current_ctf)
# Do some stuff with ctf
# Runs
current_ctf_dict = current_ctf.to_dict()
ctf_parameter = EMAN2.EMAN2Ctf()
ctf_parameter.from_dict(current_ctf_dict)
# Fails
for value in range(1):
ctf_parameter = EMAN2.EMAN2Ctf()
ctf_parameter.from_dict(current_ctf_dict)
# Do some stuff with ctf
Best,
Thorsten
Dr. Thorsten Wagner
Max-Planck-Institute of Molecular Physiology
Structural Biochemistry
Otto-Hahn Strasse 11
D-44227 Dortmund
Phone +49-(0)231-133-2357
Its getting even more strange.
If I use a numpy array instead of range in my loop, it works:
import EMAN2
import numpy as np
current_ctf = EMAN2.EMAN2Ctf()
# Runs
for value in range(1):
ctf_parameter = EMAN2.EMAN2Ctf(current_ctf)
# Do some stuff with ctf
# Runs
current_ctf_dict = current_ctf.to_dict()
ctf_parameter = EMAN2.EMAN2Ctf()
ctf_parameter.from_dict(current_ctf_dict)
# Runs
for value in np.array(range(1)):
ctf_parameter = EMAN2.EMAN2Ctf()
ctf_parameter.from_dict(current_ctf_dict)
# Fails
for value in range(1):
ctf_parameter = EMAN2.EMAN2Ctf()
ctf_parameter.from_dict(current_ctf_dict)
Dr. Thorsten Wagner
Max-Planck-Institute of Molecular Physiology
Structural Biochemistry
Otto-Hahn Strasse 11
D-44227 Dortmund
Phone +49-(0)231-133-2357
To unsubscribe from this group and stop receiving emails from it, send an email to eman2-develope...@googlegroups.com.
To post to this group, send email to eman2-de...@googlegroups.com.
We encountered some Segmentation Faults during our 3D refinement and tracked down the problem so I can provide a simple code example that is quite close to the real life case:
from EMAN2 import *
a = EMData(30000, 80000, 1)
b = EMData(30000, 1)
for i in range(80000):
print(i)
a.insert_clip(b, (0, i))
The problem is that the code on multiple machines crashes at loop number 71583 with a segmentation fault.
The system memory is constant at 10 Gb and not close to the maximum.
Any ideas why this could happen?
Is there some sort of internal memory allocation problem with large EMData objects?
Thank you in advance!
Best,
Markus
as a quick followup: The loop is not necessary, every index greater equals 71583 will fail.
from EMAN2 import *
a = EMData(30000, 80000, 1)
b = EMData(30000, 1)
a.insert_clip(b, (0, 71583))
Best,
Markus
________________________________________
Von: Markus Stabrin
Gesendet: Donnerstag, 21. Februar 2019 00:10
An: eman2-de...@googlegroups.com
Betreff: Memory issue with large EMData objects?
Yes.
The real life test has a shape of 29768, 158134.
But it did not fit into my laptops memory and as it fails at about 71000 anyways I reduced the dimensions to 80000 (so half of the values we encountered) for this test case.
Best,
Markus
________________________________________
Von: eman2-de...@googlegroups.com <eman2-de...@googlegroups.com> im Auftrag von Paul Penczek <pawe...@att.net>
Gesendet: Donnerstag, 21. Februar 2019 00:17
An: eman2-de...@googlegroups.com
Betreff: Re: [eman2-developers] Memory issue with large EMData objects?