Lots of small changes

This commit is contained in:
Abe Levitan committed 2019-08-15 11:14:20 -04:00
1 parent 06ce14fac9
commit f769806e68
11 files changed
+165 -80

No files matched your search

+37 -23
View File
@@ -35,12 +35,17 @@ if __name__ == '__main__':
# If it's a length-one reconstruction
dataset = {key: [dataset[key]] for key in dataset}
calc_prtf = False
# Orthogonalize the probes
dataset['probe'] = [orthogonalize_probes(p) for p in dataset['probe']]
print('hi')
synth_probe, synth_obj, aligned_objs = synthesize_reconstructions(
dataset['probe'], dataset['obj'], args.use_probe)
print('hey')
if calc_prtf:
freqs, prtf = calc_consistency_prtf(synth_obj, aligned_objs, dataset['basis'][0])
freqs, prtf = calc_consistency_prtf(synth_obj, aligned_objs, dataset['basis'][0], nbins=200)
# Either plot the only probe, or plot the dominant probe
if len(synth_probe.shape) == 2:
@@ -48,36 +53,45 @@ if __name__ == '__main__':
plotting.plot_amplitude(synth_probe,basis=dataset['basis'][0])
plotting.plot_colorized(synth_probe,basis=dataset['basis'][0])
else:
plotting.plot_phase(synth_probe[0],basis=dataset['basis'][0])
plotting.plot_amplitude(synth_probe[0],basis=dataset['basis'][0])
plotting.plot_colorized(synth_probe[0],basis=dataset['basis'][0])
# Plot as many probes as exist
try:
for i in range(0,50):
plotting.plot_phase(synth_probe[i],basis=dataset['basis'][0])
plt.title('Probe ' + str(i+1) + 'Phase')
plotting.plot_amplitude(synth_probe[i],basis=dataset['basis'][0])
plt.title('Probe ' + str(i+1) + ' Amplitude')
plotting.plot_colorized(synth_probe[i],basis=dataset['basis'][0])
plt.title('Probe ' + str(i+1) + ' Colorized')
except IndexError:
pass
plotting.plot_amplitude(aligned_objs[0][300:-300,300:-300],basis=dataset['basis'][0])
plotting.plot_colorized(aligned_objs[0][300:-300,300:-300],basis=dataset['basis'][0])
plotting.plot_phase(aligned_objs[0][300:-300,300:-300],basis=dataset['basis'][0])
# plot the subdominant probe if it exists
plotting.plot_amplitude(synth_obj[300:-300,300:-300],basis=dataset['basis'][0])
plotting.plot_colorized(synth_obj[300:-300,300:-300],basis=dataset['basis'][0])
plotting.plot_phase(synth_obj[300:-300,300:-300],basis=dataset['basis'][0])
try:
plotting.plot_phase(synth_probe[1],basis=dataset['basis'][0])
plotting.plot_amplitude(synth_probe[1],basis=dataset['basis'][0])
plotting.plot_colorized(synth_probe[1],basis=dataset['basis'][0])
real_translations = dataset['translation'][0]
real_translations -= np.min(real_translations,axis=0)[None,:]
real_translations = real_translations
plotting.plot_translations(real_translations)
plotting.plot_nanomap(real_translations,dataset['weights'][0])
except:
pass
plotting.plot_amplitude(synth_obj,basis=dataset['basis'][0])
plotting.plot_colorized(synth_obj,basis=dataset['basis'][0])
plotting.plot_phase(synth_obj,basis=dataset['basis'][0])
plt.figure()
try:
real_translations = dataset['basis'][0].dot(dataset['translation'][0].transpose())
real_translations -= np.min(real_translations,axis=1)[:,None]
real_translations = real_translations.transpose()
plotting.plot_translations(real_translations)
plt.figure()
except:
pass
plt.imshow(np.sqrt(dataset['background'][0]))
if calc_prtf:
plt.figure()
plt.plot(freqs*1e-6, prtf)
plt.xlabel('Spatial Frequency (cycles/um)')
plt.ylabel('Consistency Based PRTF')
plt.grid()
plt.show()