diff --git a/notebooks/LPD/LPD_Correct_Fast.ipynb b/notebooks/LPD/LPD_Correct_Fast.ipynb index 33e904a2ec149c34e818bd29c77b19530d96a087..adef3b49fb677718c78cf89d56e66235d5cd088c 100644 --- a/notebooks/LPD/LPD_Correct_Fast.ipynb +++ b/notebooks/LPD/LPD_Correct_Fast.ipynb @@ -393,10 +393,12 @@ " open_time = perf_counter() - start\n", " \n", " # Load raw data for this file.\n", + " # Reshaping gets rid of the extra 1-len dimensions without\n", + " # mangling the frame axis for an actual frame count of 1.\n", " start = perf_counter()\n", - " in_raw = inp_source['image.data'].ndarray().squeeze()\n", - " in_cell = inp_source['image.cellId'].ndarray().squeeze()\n", - " in_pulse = inp_source['image.pulseId'].ndarray().squeeze()\n", + " in_raw = inp_source['image.data'].ndarray().reshape(-1, 256, 256)\n", + " in_cell = inp_source['image.cellId'].ndarray().reshape(-1)\n", + " in_pulse = inp_source['image.pulseId'].ndarray().reshape(-1)\n", " read_time = perf_counter() - start\n", " \n", " # Allocate output arrays.\n", @@ -431,11 +433,11 @@ " \n", " outp_source.create_index(image=image_counts)\n", " outp_source.create_key('image.cellId', data=in_cell,\n", - " chunks=(chunks_ids,))\n", + " chunks=(min(chunks_ids, in_cell.shape[0]),))\n", " outp_source.create_key('image.pulseId', data=in_pulse,\n", - " chunks=(chunks_ids,))\n", + " chunks=(min(chunks_ids, in_pulse.shape[0]),))\n", " outp_source.create_key('image.data', data=out_data,\n", - " chunks=(chunks_data, 256, 256))\n", + " chunks=(min(chunks_data, out_data.shape[0]), 256, 256))\n", " write_compressed_frames(\n", " out_gain, outp_file, f'INSTRUMENT/{outp_source_name}/image/gain', comp_threads=8)\n", " write_compressed_frames(\n",