本文整理汇总了Python中joblib.Parallel.copy方法的典型用法代码示例。如果您正苦于以下问题:Python Parallel.copy方法的具体用法?Python Parallel.copy怎么用?Python Parallel.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类joblib.Parallel
的用法示例。
在下文中一共展示了Parallel.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from joblib import Parallel [as 别名]
# 或者: from joblib.Parallel import copy [as 别名]
def __init__(self):
global transport
variables = ['zonal_transport','meridional_transport','psi']
num_cores = 6
data = np.ones((len(variables),len(scow.months),scow.latitude.shape[0],scow.longitude.shape[0]))*np.nan
f = c.f.repeat(scow.longitude.shape[0]).reshape((c.f.shape[0],scow.longitude.shape[0]))
for i in xrange(scow.data.shape[1]):
zonal_transport = scow.data[1,i,:,:]/(f*c.rho)
meridional_transport = -scow.data[0,i,:,:]/(f*c.rho)
transport = meridional_transport.copy()
psi = Parallel(n_jobs=num_cores)(delayed(integration)(lat) for lat in scow.latitude)
psi = np.array(psi)
D = np.array([zonal_transport.copy()/1.e+6,meridional_transport.copy()/1.e+6,psi.copy()/1.e+6])
data[:,i,:,:] = D
del transport
# "Isolating" the subtropical gyre
ibad = (np.abs(scow.latitude) <= 5) | (np.abs(scow.latitude) >= 50)
data[:,:,ibad,:] = np.nan
self.latitude = scow.latitude
self.longitude = scow.longitude
self.variables = variables
self.data = data
示例2: abs
# 需要导入模块: from joblib import Parallel [as 别名]
# 或者: from joblib.Parallel import copy [as 别名]
# Now lets try and work out how many unique events we have just to compare
# with the GeoNet catalog of 20 events on this day in this sequence
for master in detections:
keep = True
for slave in detections:
if not master == slave and\
abs(master.detect_time - slave.detect_time) <= 6.0:
# If the events are within 6s of each other then test which
# was the 'best' match, strongest detection
if not master.detect_val > slave.detect_val:
keep = False
break
if keep:
unique_detections.append(master)
print('We made a total of ' + str(len(unique_detections)) + ' detections')
for detection in unique_detections:
print('Detection at :' + str(detection.detect_time) + ' for template ' +
detection.template_name + ' with a cross-correlation sum of: ' +
str(detection.detect_val))
# We can plot these too
stplot = st.copy()
template = templates[template_names.index(detection.template_name)]
lags = sorted([tr.stats.starttime for tr in template])
maxlag = lags[-1] - lags[0]
stplot.trim(starttime=detection.detect_time - 10,
endtime=detection.detect_time + maxlag + 10)
plotting.detection_multiplot(stplot, template,
[detection.detect_time.datetime])