我需要有关如何按位置然后按大小将以下收藏分组的帮助:
#The channel containing some eye-blinks
X = f1ep1_data[:,[4]]
#run ICA on signal
ica = FastICA(n_components=2)
ica.fit(X)
#reconstruct signal with independent components
components = ica.fit_transform(X)
X_restored = ica.inverse_transform(components)
fig1 = plt.figure()
plt.subplot(3,1,1)
plt.title("Original signal")
plt.plot(f1ep1_timescale, X)
plt.subplot(3,1,2)
plt.title("Components")
plt.plot(f1ep1_timescale, components)
plt.subplot(3,1,3)
plt.title("Signal Reconstructed")
plt.plot(f1ep1_timescale, X_restored)
plt.draw()
这是预期的结果:
真的很感谢,谢谢!
答案 0 :(得分:0)
可能不优雅,但这可以做到:
$locations = $this->records->unique('location_id');
$transformed = [];
foreach ($locations as $location) {
$sizes = $this->records->whereStrict('location_id', $location->location_id);
$transformedSizes = [];
foreach ($sizes as $size) {
$transformedSizes[] = [
'id' => $size->size_id,
'code' => $size->size_code,
'available_boxes' => $size->available_boxes
];
};
$transformed[] = array_merge(
[
'id' => $location->location_id,
'address' => $location->location_address,
'image' => $location->location_image
],
[
'sizes' => $transformedSizes
]
);
}
return $transformed;