Skip to content

PicklingError while running pergrams.clean() #25

@MXK606

Description

@MXK606

Hey everyone!

I recently installed the ivs package on my Mac and when I run the pergrams.clean function, I get the following error;

PicklingError                             Traceback (most recent call last)
<ipython-input-5-c28bacec0f40> in <module>
     10 
     11 niter,freqbins = 10,[0,1.2]
---> 12 p2 = pergrams.clean(times,signal,fn=1.2,gain=1.0,niter=niter,freqbins=freqbins)

~/opt/anaconda3/lib/python3.8/site-packages/ivs/timeseries/decorators.py in globpar(*args, **kwargs)
    122                 logger.debug("Weights were initially not normalized: normalization performed.")
    123                 kwargs['weights'] = weights
--> 124         return fctn(times,signal,*args[2:],**kwargs)
    125 
    126     return globpar

~/opt/anaconda3/lib/python3.8/site-packages/ivs/timeseries/decorators.py in globpar(*args, **kwargs)
     52             logger.debug("parallel: starting process %s: f=%.4f-%.4f"%(i,kwargs['f0'],kwargs['fn']))
     53             p = Process(target=fctn, args=myargs, kwargs=kwargs)
---> 54             p.start()
     55             all_processes.append(p)
     56 

~/opt/anaconda3/lib/python3.8/multiprocessing/process.py in start(self)
    119                'daemonic processes are not allowed to have children'
    120         _cleanup()
--> 121         self._popen = self._Popen(self)
    122         self._sentinel = self._popen.sentinel
    123         # Avoid a refcycle if the target function holds an indirect

~/opt/anaconda3/lib/python3.8/multiprocessing/context.py in _Popen(process_obj)
    222     @staticmethod
    223     def _Popen(process_obj):
--> 224         return _default_context.get_context().Process._Popen(process_obj)
    225 
    226 class DefaultContext(BaseContext):

~/opt/anaconda3/lib/python3.8/multiprocessing/context.py in _Popen(process_obj)
    282         def _Popen(process_obj):
    283             from .popen_spawn_posix import Popen
--> 284             return Popen(process_obj)
    285 
    286     class ForkServerProcess(process.BaseProcess):

~/opt/anaconda3/lib/python3.8/multiprocessing/popen_spawn_posix.py in __init__(self, process_obj)
     30     def __init__(self, process_obj):
     31         self._fds = []
---> 32         super().__init__(process_obj)
     33 
     34     def duplicate_for_child(self, fd):

~/opt/anaconda3/lib/python3.8/multiprocessing/popen_fork.py in __init__(self, process_obj)
     17         self.returncode = None
     18         self.finalizer = None
---> 19         self._launch(process_obj)
     20 
     21     def duplicate_for_child(self, fd):

~/opt/anaconda3/lib/python3.8/multiprocessing/popen_spawn_posix.py in _launch(self, process_obj)
     45         try:
     46             reduction.dump(prep_data, fp)
---> 47             reduction.dump(process_obj, fp)
     48         finally:
     49             set_spawning_popen(None)

~/opt/anaconda3/lib/python3.8/multiprocessing/reduction.py in dump(obj, file, protocol)
     58 def dump(obj, file, protocol=None):
     59     '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60     ForkingPickler(file, protocol).dump(obj)
     61 
     62 #

PicklingError: Can't pickle <function clean at 0x7f9482adb0d0>: it's not the same object as ivs.timeseries.pergrams.clean

I found an answer to this error on stack overflow here but I'm not sure if I understand the error properly.

I ran the following code in a Jupyter Notebook;

import numpy as np
import matplotlib.pyplot as plt
from ivs.timeseries import pergrams

## Clean test

times_ = np.linspace(0,150,1000)
times = np.array([times_[i] for i in range(len(times_)) if (i%10)>7])
signal = np.sin(2*np.pi/10*times) + np.random.normal(size=len(times))

niter,freqbins = 10,[0,1.2]
p2 = pergrams.clean(times,signal,fn=1.2,gain=1.0,niter=niter,freqbins=freqbins)

Please could someone assist me in fixing this issue?
The python version is 3.8.5 and the Jupyter Notebook version is 6.1.4

Thanks!

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