Dev: Multiprocessing
Warning
DEVELOPMENT TESTING MAY BE INCOMPLETE / NON FUNCTIONAL
Methods for accelerating program execution by using multiprocessing. Currently in development.
Exectution example in ./Example Code/DEV Inter-process communication/devBufferingTest.py.
Requires extra dependancies be installed:
pip install -e git+https://github.com/TheMuonNeutrino/magSonify#egg=magSonify[bufferingTest]
BaseProcess
- class magSonify.Buffering.BaseProcess(task, taskArgs, queues, name=None)
Bases:
multiprocessing.context.ProcessBase process for multiprocessing
- importer(events: tuple, dataClass=<class 'magSonify.MagnetometerData.THEMISdata'>)
Multiprocessing wrapper of CDAS import.
- Parameters
dataClass – The high level class for satellite data, subclassed from
MagnetometerData. eg.THEMISdata. Should implement method.importCDAS(startDatetime,endDateTime,[*args])Should implement method.defaultProcessing([*args])events – Tuple, each value contain a tuple with args for importCDAS in the form (startDatetime,endDatetime,*args)
- playback(sampleRate=22050)
Multiprocessing method for playing audio as a continous output stream
- processing(processingArgs: tuple = ())
Multiprocessing wrapper of default processing.
- Parameters
processingArgs – Args for
dataClass.defaultProcessing(See for example:THEMISdata.defaultProcessing())
- sonification(axis: int = 1, algorithm: str = 'waveletStretch', algArgs: tuple = (16, 0.5, 16))
Multiprocessing wrapper of time stretching signal for sonification.
- Parameters
axis (int) – The axis along which to extract sound audio. Can be
int0,1or2.algorithm – String referencing the time stretching algorithm to use. Can be
'waveletStretch','paulStretch','phaseVocoderStretch'or'wsolaStretch'.algArgs (Tuple) – The arguments to be passed to time stretching function.
- class magSonify.Buffering.STOPVALUE
Indicates that a queue has finished, no new values will be put. eg.
def myWorker(): while True: # Does some processing, breaks out of the loop when done myQueue.put(val) break myQueue.put(STOPVALUE())