Commit fc25c1a2 authored by Akdel's avatar Akdel

reverted

parent 66b80beb
......@@ -29,22 +29,16 @@ def section_vs_section(section1, section2, fft_molecules, fft_rev_molecules, max
for i in range(section1[0], section1[1], width):
t = time.time()
print(i)
subject_molecules = fft_molecules[i:i+width]
rev_subject_molecules = fft_rev_molecules[i:i+width]
multiple_corr_maxes = np.zeros((subject_molecules.shape[0], db_molecules.shape[0]), dtype=float)
fft_products1 = np.zeros((db_molecules.shape[0],db_molecules.shape[1]), dtype=complex)
fft_products2 = np.zeros((db_molecules.shape[0],db_molecules.shape[1]), dtype=complex)
corr_maxes = np.zeros(fft_molecules.shape[0])
multiple_top_corrs = get_multiple_products(subject_molecules, rev_subject_molecules, db_molecules, multiple_corr_maxes,
fft_products1, fft_products2, corr_maxes)
multiple_top_corrs = get_multiple_products(subject_molecules, rev_subject_molecules, db_molecules)
mol_range = np.arange(i, i + width)
normalized_top_corrs = np.zeros(multiple_top_corrs.shape)
numba_normalize_molecule_correlation_array(multiple_top_corrs, maxes, section2, mol_range, normalized_top_corrs)
del multiple_top_corrs, mol_range
numba_arg_sort(normalized_top_corrs, results[i:i+width], top, int(section2[0]))
print(time.time() - t)
print(time.time()-t)
return results[section1[0]:section1[1]]
......@@ -61,15 +55,15 @@ def create_and_link_paired_matrices(period, fft_molecules, fft_rev_molecules, ma
# @nb.jit
def get_multiple_products(fft_subject_molecules, fft_subject_rev_molecules, fft_molecules, multiple_corr_maxes, fft_products1, fft_products2, corr_maxes):
# multiple_corr_maxes = np.zeros((fft_subject_molecules.shape[0], fft_molecules.shape[0]), dtype=float)
# fft_products1 = np.zeros((fft_molecules.shape[0],fft_molecules.shape[1]), dtype=complex)
# fft_products2 = np.zeros((fft_molecules.shape[0],fft_molecules.shape[1]), dtype=complex)
# corr_maxes = np.zeros(fft_molecules.shape[0])
def get_multiple_products(fft_subject_molecules, fft_subject_rev_molecules, fft_molecules):
multiple_corr_maxes = np.zeros((fft_subject_molecules.shape[0], fft_molecules.shape[0]), dtype=float)
fft_products1 = np.zeros((fft_molecules.shape[0],fft_molecules.shape[1]), dtype=complex)
fft_products2 = np.zeros((fft_molecules.shape[0],fft_molecules.shape[1]), dtype=complex)
corr_maxes = np.zeros(fft_molecules.shape[0])
for i in range(fft_subject_molecules.shape[0]):
# print("running numba_get_products")
print("running numba_get_products")
numba_get_products(fft_subject_molecules[i], fft_subject_rev_molecules[i], fft_molecules, fft_products1, fft_products2)
# print("running get_corr_maxes and ifft")
print("running get_corr_maxes and ifft")
numba_get_corr_maxes(np.fft.ifft(fft_products1).real, np.fft.ifft(fft_products2).real, corr_maxes)
multiple_corr_maxes[i,:] = corr_maxes
return multiple_corr_maxes
......@@ -164,7 +158,7 @@ def detect_repeat(nick_coordinates, diff_thr=1., num_thr=5):
def run_section_for_all_vs_all(fft_molecules: np.ndarray, fft_rev_molecules: np.ndarray, maxes: np.ndarray,
mol_range: (int, int), output_folder: str, file_prefix: str):
file_name = file_prefix + ("_%s-%s.npy" % mol_range)
section = section_vs_section(mol_range, (0, fft_molecules.shape[0]), fft_molecules, fft_rev_molecules, maxes, width=5, top=300)
section = section_vs_section(mol_range, (0, fft_molecules.shape[0]), fft_molecules, fft_rev_molecules, maxes, width=1000, top=300)
np.save(output_folder + file_name, section)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment