js=js_open_dict("./spt_12/particle_parms_04.json")
keys=js.keys()
srcname_list=[]
ptcl_source_coord_list=[]
data_n_list=[]
for k in keys:
src, ii = eval(k)
e=EMData(src, ii, True)
srcname=e["file_twod"]
ptcl_source_coord_list.append(e["ptcl_source_coord"])
srcname_list.append(base_name(srcname))
data_n_list.append(e["data_n"])
length = len(srcname_list)
a={}
for i in range(length):
a[srcname_list[i]]=[]
for j in range(length):
p1=np.array(ptcl_source_coord_list[i])
p2=np.array(ptcl_source_coord_list[j])
squared_dist = np.sum((p1-p2)**2, axis=0)
#diff_data_n=abs(int(data_n_list[i])-int(data_n_list[j]))
dist = np.sqrt(squared_dist)
if srcname_list[i]==srcname_list[j] and dist <threshold: #(if expanded particles have the same data_source or srcname and they are within a threshold distance, then they are considered to be from the same parent)
a[srcname_list[i]].append(ptcl_source_coord_list[j])
with open("sample.json", "w") as outfile:
json.dump(a, outfile)
--
--
----------------------------------------------------------------------------------------------
You received this message because you are subscribed to the Google
Groups "EMAN2" group.
To post to this group, send email to em...@googlegroups.com
To unsubscribe from this group, send email to eman2+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/eman2
---
You received this message because you are subscribed to the Google Groups "EMAN2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eman2+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eman2/80ab2067-53d8-4fac-b223-b73b4e95373dn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eman2/48d9e58e-0277-4e27-a14b-f5aa95a5527an%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/eman2/6d9812aa-cfcf-4d2f-a3db-fd110c65537bn%40googlegroups.com.