Skip to content

piscat does not work with parallel processing #46

@mnotrin

Description

@mnotrin

As soon as I set the parallel loop in piscat functions, i.e.,


# Github Issues Example for Piscat 

import numpy as np
from piscat.Visualization import * 
from piscat.Preproccessing import * 
from piscat.BackgroundCorrection import *
from piscat.InputOutput import *
import matplotlib.pyplot as plt

videoraw_path = r"C:\write\the\path\to\the\video.raw" 

# load the raw video with piscat
video = video_reader(file_name=videoraw_path, type='binary', img_width=256, img_height=256,
                                   image_type=np.dtype('<u2'), s_frame=0, e_frame=-1) 

video_pn, power = Normalization(video).power_normalized(inter_flag_parallel_active = True) 

I immediately obtain errors, in the form :

"...\joblib\parallel.py", line 763, in _return_or_raise
raise self._result
UnboundLocalError: local variable 'sum_img_pixels' referenced before assignment"

and for differential averaging:

video_dr = DifferentialRollingAverage(video, batchSize=batch_size, mode_FPN=cFPN)
video_dra, _ = video_dr.differential_rolling(FPN_flag=True, select_correction_axis='Both', FFT_flag=True)

I have obtained memory errors even though there is enough RAM (32 GB) for this process.
Furthermore, If I try to perform fFPN, with FFT_flag=False it automatically fails anyway because this filter already is computed in a parallel loop.

PSF detection functions also do not work if I do not manually set the parallel looping to inactive, i.e.,

display_psf = DisplayDataFramePSFsLocalization(dra_video, df_PSFs, 0.1, False , save_path)
# display_psf.cpu.parallel_active = False
display_psf.run()

It gives the error that the object "DisplayDataFramePSFsLocalization" cannot be pickled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions