Exemplo n.º 1
0
 def _getBmultiList(self, listOfArgs, processes=Auto):
     # Used in getBsweep() For lists of positions for B field samples to be
     # calculated in parallel. Return a list of calculated B field samples.
     pool = initializeMulticorePool(processes)
     results = pool.map(self.getB, listOfArgs)
     pool.close()
     pool.join()
     return array(results)
Exemplo n.º 2
0
 def _getBsweepObj(self, pos, processes):
     # In the case there are many objects and few positions in the collection
     # treat parallelization this way:
     # Take every object in parallel and sequentially calculate getB for each.
     pool = initializeMulticorePool(processes)
     results = pool.starmap(
         self._getBsweepObj_pickle,
         zip(repeat(pos, times=len(self.sources)), self.sources))
     pool.close()
     pool.join()
     return array(results)
Exemplo n.º 3
0
 def _getBDisplacement(self, listOfArgs, processes=Auto):
     # Used in getBparallel() For lists of arguments where first argument is
     # a position for a B field sample Second argument is the magnet's
     # absolute position vector Third argument is a tuple of the magnet's
     # absolute rotation arguments
     pool = initializeMulticorePool(processes)
     results = pool.starmap(
         recoordinateAndGetB,
         zip(repeat(self, times=len(listOfArgs)), listOfArgs))
     pool.close()
     pool.join()
     return array(results)