8000 SBS dispersion propagation fix by yangelis · Pull Request #515 · pylhc/omc3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SBS dispersion propagation fix #515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions omc3/segment_by_segment/propagables/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from omc3.segment_by_segment.propagables.phase import Phase
from omc3.segment_by_segment.propagables.beta import BetaPhase
from omc3.segment_by_segment.propagables.alpha import AlphaPhase
from omc3.segment_by_segment.propagables.dispersion import Dispersion #noqa -> expose
from omc3.segment_by_segment.propagables.dispersion import Dispersion, DispersionMomentum #noqa -> expose
from omc3.segment_by_segment.propagables.coupling import F1001, F1010 #noqa -> expose


ALL_PROPAGABLES: tuple[type[Propagable], ...] = (Phase, BetaPhase, AlphaPhase, Dispersion, F1001, F1010)
ALL_PROPAGABLES: tuple[type[Propagable], ...] = (Phase, BetaPhase, AlphaPhase, Dispersion, DispersionMomentum, F1001, F1010)
34 changes: 34 additions & 0 deletions omc3/segment_by_segment/propagables/dispersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,37 @@ def _compute_elements(self, plane: str, seg_model: pd.DataFrame, forward: bool):
model_phase = Phase.get_segment_phase(seg_model, plane, forward)
propagated_err = sbs_math.propagate_error_dispersion(model_disp, model_phase, init_condition)
return model_disp, propagated_err


class DispersionMomentum(Propagable):

_init_pattern = "dp{}_{}" # format(plane, ini/end)
columns: PropagableColumns = PropagableColumns("DP")

@classmethod
def get_at(cls, names: IndexType, meas: OpticsMeasurement, plane: str) -> ValueErrorType:
c = cls.columns.planed(plane)
ddispersion = meas.dispersion[plane].loc[names, c.column]
# error = meas.dispersion[plane].loc[names, c.error_column]
return ddispersion, 0

@classmethod
def in_measurement(cls, meas: OpticsMeasurement) -> bool:
""" Check if the dispersion is in the measurement data. """
try:
meas.dispersion_x
meas.dispersion_y
except FileNotFoundError:
return False
return True

def add_differences(self, segment_diffs: SegmentDiffs):
""" No need for differences, for now """
return None

def get_segment_observation_points(self, plane: str):
""" Return the measurement points for the given plane, that are in the segment. """
return common_indices(
self.segment_models.forward.index,
self._meas.dispersion[plane].index
)
Loading
0