foz commited on
Commit
305e5eb
1 Parent(s): d3eee8e

Change relative intensity normalization

Browse files
Files changed (1) hide show
  1. path_analysis/analyse.py +6 -2
path_analysis/analyse.py CHANGED
@@ -288,7 +288,11 @@ def extract_peaks(cell_id, all_paths, path_lengths, measured_traces, config):
288
  data = []
289
  foci_absolute_intensity, foci_position, foci_position_index, trace_median_intensities, trace_thresholds = analyse_traces(all_paths, path_lengths, measured_traces, config)
290
 
291
- total_intensity = sum(sum(path_foci_abs_int - tmi) for path_foci_abs_int, tmi in zip(foci_absolute_intensity, trace_median_intensities))
 
 
 
 
292
  trace_positions = []
293
 
294
  for i in range(n_paths):
@@ -308,7 +312,7 @@ def extract_peaks(cell_id, all_paths, path_lengths, measured_traces, config):
308
  else:
309
  path_data[f'Foci_{j+1}_position(um)'] = u
310
  path_data[f'Foci_{j+1}_absolute_intensity'] = v
311
- path_data[f'Foci_{j+1}_relative_intensity'] = (v - trace_median_intensities[i])/total_intensity
312
  data.append(path_data)
313
  trace_positions.append(pl)
314
  return pd.DataFrame(data), foci_absolute_intensity, foci_position_index, trace_thresholds, trace_positions
 
288
  data = []
289
  foci_absolute_intensity, foci_position, foci_position_index, trace_median_intensities, trace_thresholds = analyse_traces(all_paths, path_lengths, measured_traces, config)
290
 
291
+ foci_intensities = []
292
+ for path_foci_abs_int, tmi in zip(foci_absolute_intensity, trace_median_intensities):
293
+ foci_intensities.extend(list(path_foci_abs_int - tmi))
294
+
295
+ mean_intensity = np.mean(foci_intensities)
296
  trace_positions = []
297
 
298
  for i in range(n_paths):
 
312
  else:
313
  path_data[f'Foci_{j+1}_position(um)'] = u
314
  path_data[f'Foci_{j+1}_absolute_intensity'] = v
315
+ path_data[f'Foci_{j+1}_relative_intensity'] = (v - trace_median_intensities[i])/mean_intensity
316
  data.append(path_data)
317
  trace_positions.append(pl)
318
  return pd.DataFrame(data), foci_absolute_intensity, foci_position_index, trace_thresholds, trace_positions