diff --git a/sed/core/processor.py b/sed/core/processor.py index 83b36932..5cfb92ea 100644 --- a/sed/core/processor.py +++ b/sed/core/processor.py @@ -778,11 +778,11 @@ def apply_momentum_calibration( df=self._dataframe, calibration=calibration, ) - if self._timed_dataframe is not None: - self._timed_dataframe, _ = self.mc.append_k_axis( - df=self._timed_dataframe, - calibration=calibration, - ) + # if self._timed_dataframe is not None: + # self._timed_dataframe, _ = self.mc.append_k_axis( + # df=self._timed_dataframe, + # calibration=calibration, + # ) # Add Metadata self._attributes.add( @@ -1231,12 +1231,12 @@ def append_energy_axis( calibration=calibration, **kwds, ) - if self._timed_dataframe is not None: - self._timed_dataframe, _ = self.ec.append_energy_axis( - df=self._timed_dataframe, - calibration=calibration, - **kwds, - ) + # if self._timed_dataframe is not None: + # self._timed_dataframe, _ = self.ec.append_energy_axis( + # df=self._timed_dataframe, + # calibration=calibration, + # **kwds, + # ) # Add Metadata self._attributes.add( @@ -1438,12 +1438,12 @@ def add_jitter( amps=amps, **kwds, ) - if self._timed_dataframe is not None: - self._timed_dataframe = self._timed_dataframe.map_partitions( - apply_jitter, - cols=cols, - cols_jittered=cols, - ) + # if self._timed_dataframe is not None: + # self._timed_dataframe = self._timed_dataframe.map_partitions( + # apply_jitter, + # cols=cols, + # cols_jittered=cols, + # ) metadata = [] for col in cols: metadata.append(col) diff --git a/tutorial/5 - hextof workflow.ipynb b/tutorial/5 - hextof workflow.ipynb index 9675d266..50b57861 100644 --- a/tutorial/5 - hextof workflow.ipynb +++ b/tutorial/5 - hextof workflow.ipynb @@ -64,11 +64,29 @@ "source": [ "config={\"core\": {\"paths\": {\n", " \"data_raw_dir\": \"/asap3/flash/gpfs/pg2/2023/data/11019101/raw/hdf/offline/fl1user3\", \n", - " \"data_parquet_dir\": \"/home/agustsss/temp/sed_parquet/\"\n", + " \"data_parquet_dir\": \"/home/agustsss/temp/sed_parquet_2/\"\n", "}}}\n", "sp = SedProcessor(runs=[44797], config=config, user_config=config_file, system_config={}, collect_metadata=False)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.dataframe" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.timed_dataframe" + ] + }, { "cell_type": "code", "execution_count": null, @@ -79,6 +97,151 @@ "sp.align_dld_sectors()" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from dask.diagnostics import ProgressBar" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "with ProgressBar():\n", + " tdf = sp.timed_dataframe.compute()\n", + " df = sp.dataframe.compute()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "tdf" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "tdf['delayStage'].min(), tdf['delayStage'].max(), tdf['delayStage'].max() - tdf['delayStage'].min()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "plt.figure()\n", + "df['delayStage'].plot()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "df" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print(f'{len(tdf):,.0f}, {len(df):,.0f}')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp.append_tof_ns_axis()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "axes = ['sampleBias','delayStage','dldTime']\n", + "bins = [1, 50, 250]\n", + "ranges = [[30.9,31.1],[1461.9626, 1464.9075], [650,800]]\n", + "res = sp.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "plt.figure()\n", + "res.plot()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "axes = ['delayStage']\n", + "bins = [50]\n", + "ranges = [[1461.9626, 1464.9075]]\n", + "res = sp.compute(bins=bins, axes=axes, ranges=ranges)#, normalize_to_acquisition_time=\"delayStage\")\n", + "resnorm = sp.compute(bins=bins, axes=axes, ranges=ranges, normalize_to_acquisition_time=\"delayStage\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "plt.figure()\n", + "res = res / res.mean() * resnorm.mean()\n", + "res.plot()\n", + "resnorm.plot()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "sp._normalization_histogram" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -521,18 +684,6 @@ "display_name": "sed38", "language": "python", "name": "sed38" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.18" } }, "nbformat": 4,