Skip to content

Commit dce8483

Browse files
committed
Updated Requirements
1 parent d0a3ec1 commit dce8483

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

src/AnalysisFunctions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,9 @@ def threshold_cell_areas_3d(
13721372
cell_mask_new = np.asarray(
13731373
ski.morphology.binary_closing(
13741374
cell_mask_new,
1375-
footprint=ski.morphology.footprint_rectangle((1, erosionsize, erosionsize)),
1375+
footprint=ski.morphology.footprint_rectangle(
1376+
(1, erosionsize, erosionsize)
1377+
),
13761378
),
13771379
dtype=bool,
13781380
)

src/Image_Analysis_Functions.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def default_SMD_routine(self, image, d=2, pfa=1e-6, localise_in_first_frame=Fals
191191
image (array): image as numpy array
192192
d (int): integer for pyRASP intensity analyses
193193
pfa (float): probability of false alarm for spot detection code
194-
194+
195195
Returns:
196196
centroids (2D array): centroid positions per oligomer
197197
estimated_intensity (numpy.ndarray): Estimated sum intensity per oligomer.
@@ -419,14 +419,16 @@ def infocus_indices(self, focus_scores, cluster_size=4):
419419

420420
hdb.fit(focus_scores.reshape(-1, 1))
421421
if len(np.unique(hdb.labels_)) == 1:
422-
return np.array([0, 0]) # no in-focus slices
422+
return np.array([0, 0]) # no in-focus slices
423423
else:
424424
mean_scores = np.zeros(len(np.unique(hdb.labels_)))
425425
for i, l in enumerate(np.unique(hdb.labels_)):
426426
mean_scores[i] = np.mean(focus_scores[hdb.labels_ == l])
427427
focus_label = np.unique(hdb.labels_)[np.argmax(mean_scores)]
428428
infocus_indices = np.where(hdb.labels_ == focus_label)[0]
429-
in_focus_indices = np.array([np.min(infocus_indices), np.max(infocus_indices)+1])
429+
in_focus_indices = np.array(
430+
[np.min(infocus_indices), np.max(infocus_indices) + 1]
431+
)
430432
return in_focus_indices
431433

432434
@staticmethod
@@ -546,7 +548,9 @@ def calculate_offsets(octagon_shape):
546548

547549
small_oct = ski.morphology.octagon(2, 4)
548550
outer_ind = ski.morphology.octagon(2, 5)
549-
inner_ind = np.pad(small_oct, int((outer_ind.shape[0] - small_oct.shape[0])/2))
551+
inner_ind = np.pad(
552+
small_oct, int((outer_ind.shape[0] - small_oct.shape[0]) / 2)
553+
)
550554
outer_ind -= inner_ind
551555

552556
x_inner, y_inner = calculate_offsets(inner_ind)

src/PlottingFunctions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def image_plot(
551551
axs.contour(mask, [0.5], linewidths=masklinewidth, colors=maskcolor)
552552

553553
return axs
554-
554+
555555
def image_scatter_plot(
556556
self,
557557
axs,

src/RASPRoutines.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,9 @@ def analyse_images(
633633
variance_map=self.variance_map,
634634
)
635635

636-
def _analysis_loop(img, k1, k2, img_cell, thres, large_thres, rdl, z_test, i, cell_focus):
636+
def _analysis_loop(
637+
img, k1, k2, img_cell, thres, large_thres, rdl, z_test, i, cell_focus
638+
):
637639
if cell_focus is not None:
638640
z_planes, _, _, _ = self.get_infocus_planes(img_cell, k1)
639641
_, img2, Gx, Gy = self.get_infocus_planes(img, k1)
@@ -710,7 +712,16 @@ def process_files(subfolder, files, cell_files):
710712
cell_focus = 1
711713
z_test = len(img.shape) > 2
712714
_analysis_loop(
713-
img, k1, k2, img_cell, thres, large_thres, rdl, z_test, i, cell_focus,
715+
img,
716+
k1,
717+
k2,
718+
img_cell,
719+
thres,
720+
large_thres,
721+
rdl,
722+
z_test,
723+
i,
724+
cell_focus,
714725
)
715726
if disp:
716727
print(
@@ -837,7 +848,12 @@ def filter_z_planes(to_save, z_planes):
837848
return z_to_plot[z_to_plot >= 0]
838849

839850
def plot_images(
840-
z_to_plot, img, to_save, to_save_largeobjects=None, img_cell=None, cell_mask=None
851+
z_to_plot,
852+
img,
853+
to_save,
854+
to_save_largeobjects=None,
855+
img_cell=None,
856+
cell_mask=None,
841857
):
842858
for i in enumerate(z_to_plot):
843859
xpositions = to_save.filter(pl.col("z") == i[1])["x"].to_numpy()

0 commit comments

Comments
 (0)