Skip to content

Commit

Permalink
comment out requested code removals
Browse files Browse the repository at this point in the history
  • Loading branch information
steinnymir committed Oct 27, 2023
1 parent ded8675 commit 53feb0f
Show file tree
Hide file tree
Showing 2 changed files with 181 additions and 30 deletions.
34 changes: 17 additions & 17 deletions sed/core/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down
177 changes: 164 additions & 13 deletions tutorial/5 - hextof workflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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": {},
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 53feb0f

Please sign in to comment.