Skip to content

Commit

Permalink
fix future warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JoschD committed Aug 22, 2024
1 parent da73276 commit 6a3edeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion omc3/optics_measurements/beta_from_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def _assign_uncertainties(twiss_full, errordefspath):
"""
LOGGER.debug("Start creating uncertainty information")
errdefs = tfs.read(errordefspath)
twiss_full = twiss_full.assign(UNC=False, dK1=0, KdS=0, mKdS=0, dX=0, BPMdS=0)
twiss_full = twiss_full.assign(UNC=False, dK1=0.0, KdS=0.0, mKdS=0.0, dX=0.0, BPMdS=0.0)
# loop over uncertainty definitions, fill the respective columns, set UNC to true
for indx in errdefs.index:
patt = errdefs.loc[indx, "PATTERN"]
Expand Down
6 changes: 3 additions & 3 deletions omc3/optics_measurements/kick.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
This module contains kick functionality of ``optics_measurements``.
It provides functions to compute kick actions.
"""
from collections import OrderedDict
from contextlib import suppress
from os.path import join

Expand Down Expand Up @@ -63,7 +62,8 @@ def _get_kick(measure_input, files, plane):
load_columns, calc_columns, column_types = _get_column_mapping(plane)
kick_frame = pd.DataFrame(data=0.,
index=range(len(files[plane])),
columns=list(load_columns.keys()) + calc_columns)
columns=list(column_types.keys()))
kick_frame = kick_frame.astype(column_types)

for i, df in enumerate(files[plane]):
# load data directly from file
Expand Down Expand Up @@ -131,7 +131,7 @@ def _get_model_arc_betas(measure_input, plane):

def _get_column_mapping(plane):
plane_number = PLANE_TO_NUM[plane]
load_columns = OrderedDict([
load_columns = dict([
(TIME, "TIME"),
(DPP, DPP),
(DPPAMP, DPPAMP),
Expand Down
9 changes: 4 additions & 5 deletions omc3/optics_measurements/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def write_special(meas_input, phase_advances, plane_tune, plane):
'BPM2',
f'BPM_PHASE{plane}',
f'BPM_{ERR}PHASE{plane}',]
special_phase_df = pd.DataFrame(columns=special_phase_columns)
special_phase_df = pd.DataFrame()

for elem1, elem2 in accel.important_phase_advances():
mus1 = elements.loc[elem1, f"MU{plane}"] - elements.loc[:, f"MU{plane}"]
Expand All @@ -260,8 +260,7 @@ def write_special(meas_input, phase_advances, plane_tune, plane):
elems_to_bpms = -mus1.loc[minmu1] - mus2.loc[minmu2]
ph_result = ((bpm_phase_advance + elems_to_bpms) * bd)
model_value = (model_value * bd) % 1
new_row = pd.DataFrame(
dict(zip(special_phase_columns, [
new_row = pd.DataFrame([[
elem1,
elem2,
ph_result % 1,
Expand All @@ -274,8 +273,8 @@ def write_special(meas_input, phase_advances, plane_tune, plane):
minmu2,
bpm_phase_advance,
elems_to_bpms,
])),
index=[0]
]],
columns=special_phase_columns,
)

special_phase_df = pd.concat([special_phase_df, new_row], axis="index", ignore_index=True)
Expand Down

0 comments on commit 6a3edeb

Please sign in to comment.