Commit 79771f5f by Jiri Borovec

fix: skip recomputed encodings

parent 6c5cea9c
......@@ -6,6 +6,10 @@ We assume going from all patters presented to single pattern in the atlas
EXAMPLE:
>> python run_apd_hierarchical_cluster.py \
--path_in /datagrid/Medical/microscopy/drosophila/TEMPORARY/experiments_APDL_real
>> python run_apd_hierarchical_cluster.py \
--path_in ~/Medical-data/microscopy/drosophila/RESULTS/experiments_APD_real
>> python run_apd_hierarchical_cluster.py \
--path_in /datagrid/Medical/microscopy/drosophila/TEMPORARY/experiments_APD_temp \
--names_expt ExperimentALPE_mp_real_type_3_segm_reg_binary_gene_ssmall_20160509-155333 \
......@@ -37,6 +41,7 @@ PREFIX_RECONST = 'reconstruct_'
CSV_RECONT_DIFF = 'reconstruct_hierarchical_clustering.csv'
POSIX_CSV_SKIP = r_reconst.POSIX_CSV_NEW
DIR_PREFIX = 'hierarchical_clustering_'
POSIX_MERGED = 'merged_nb_labels_%i'
def compute_merged_reconst_diff(ptn_comb, dict_params, path_out, atlas, img_names):
......@@ -115,12 +120,11 @@ def export_partial_atlas_encode(dict_params, path_out, df_merged, max_label,
:param diff: float
:return: DF
"""
gen_data.export_image(path_out, atlas, PREFIX_ATLAS + 'merged_%i' % nb)
gen_data.export_image(path_out, atlas, PREFIX_ATLAS + POSIX_MERGED % nb)
r_reconst.export_fig_atlas(atlas, path_out,
PREFIX_ATLAS + 'merged_%i' % nb, max_label)
PREFIX_ATLAS + POSIX_MERGED % nb, max_label)
df_encode = r_reconst.recompute_encoding(dict_params, atlas)
df_encode.to_csv(
os.path.join(path_out, PREFIX_ENCODE + 'merged_%i.csv' % nb))
df_encode.to_csv(os.path.join(path_out, PREFIX_ENCODE + POSIX_MERGED % nb + '.csv'))
df_merged = df_merged.append({
'nb_labels': nb,
'merged': ptn_comb,
......@@ -155,6 +159,7 @@ def sequence_hierarchical_clustering(dict_params, path_out, img_names, atlas,
dict_params, path_out, img_names, atlas, nb_jobs)
df_merged = export_partial_atlas_encode(dict_params, path_out, df_merged,
max_label, nb, atlas, ptn_comb, diff)
df_merged.to_csv(os.path.join(path_out, CSV_RECONT_DIFF))
df_merged.set_index('nb_labels', inplace=True)
df_merged.to_csv(os.path.join(path_out, CSV_RECONT_DIFF))
return df_merged
......@@ -176,6 +181,10 @@ def process_experiment(path_expt, nb_jobs=NB_THREADS):
for path_csv in sorted(list_csv):
name_csv = os.path.basename(path_csv)
name_atlas = r_reconst.find_relevant_atlas(name_csv, atlas_names)
if name_atlas is None:
logging.warning('nor related atlas for particular csv encoding "%s"',
name_csv)
continue
logging.info('Atlas: "%s" -> Encoding: "%s"', name_atlas, name_csv)
path_atlas = os.path.join(path_expt, name_atlas)
atlas = r_reconst.load_atlas_image(path_atlas)
......@@ -188,7 +197,8 @@ def process_experiment(path_expt, nb_jobs=NB_THREADS):
df_diff.name = os.path.splitext(name_atlas)[0]
logging.debug('records: %i for "%s"', len(df_diff), df_diff.name)
df_diffs_all = pd.concat([df_diffs_all, df_diff], axis=1)
df_diffs_all.to_csv(os.path.join(path_expt, CSV_RECONT_DIFF))
df_diffs_all.to_csv(os.path.join(path_expt, CSV_RECONT_DIFF))
logging.info('processed files: %s', repr(df_diffs_all.columns))
def main():
......
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