Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,26 @@ class FrequencyTuningData:
label="Steps to Resonance",
widget_name="freq_tuning_steps_to_resonance",
)
final_detune_hz: float | None = phase_display_field(
final_timestamp: datetime | None = None

# Stepper characterization data
positive_step_increases_frequency: bool | None = phase_display_field(
default=None,
label="Final Detune",
widget_name="freq_tuning_final_detune",
format_spec=".3f",
label="Pos Step → Freq Up",
widget_name="freq_tuning_pos_step_dir",
)
hz_per_microstep: float | None = phase_display_field(
default=None,
label="Hz/Microstep",
widget_name="freq_tuning_hz_per_step",
format_spec=".4f",
unit="Hz",
)
final_timestamp: datetime | None = None
cold_landing_steps: int | None = phase_display_field(
default=None,
label="Cold Landing Steps",
widget_name="freq_tuning_cold_steps",
)

# π-mode measurement phase data
mode_8pi_9_frequency: float | None = phase_display_field(
Expand Down Expand Up @@ -222,20 +234,12 @@ def initial_detune_khz(self) -> float | None:
return None
return self.initial_detune_hz / 1000

@property
def final_detune_khz(self) -> float | None:
"""Final detune in kHz."""
if self.final_detune_hz is None:
return None
return self.final_detune_hz / 1000

@property
def cold_landing_complete(self) -> bool:
"""Check if cold landing phase is complete."""
return (
self.initial_detune_hz is not None
and self.steps_to_resonance is not None
and self.final_detune_hz is not None
)

@property
Expand All @@ -248,8 +252,8 @@ def pi_mode_complete(self) -> bool:

@property
def is_complete(self) -> bool:
"""Check if entire frequency tuning phase is complete."""
return self.cold_landing_complete and self.pi_mode_complete
"""Check if frequency tuning phase is complete."""
return self.cold_landing_complete

@property
def passed(self) -> bool:
Expand All @@ -261,7 +265,6 @@ def to_dict(self) -> dict:
self,
computed_fields=(
"initial_detune_khz",
"final_detune_khz",
"cold_landing_complete",
"pi_mode_complete",
"is_complete",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ def initialize_database_schema(
created_at TEXT NOT NULL
)
""")
_seed_operators(cursor)

cursor.execute(f"""
CREATE TABLE IF NOT EXISTS cryomodule_records (
Expand Down Expand Up @@ -223,3 +224,20 @@ def initialize_database_schema(
CREATE UNIQUE INDEX IF NOT EXISTS idx_cm_unique
ON cryomodule_records(linac, cryomodule)
""")


_DEFAULT_OPERATORS = [
"Lauren Alsberg",
"Lisa Zacarias",
"Nicole Neveu",
"Ryan Porter",
"Sebastian Aderhold",
]


def _seed_operators(cursor: sqlite3.Cursor) -> None:
for name in _DEFAULT_OPERATORS:
cursor.execute(
"INSERT OR IGNORE INTO operators (name, created_at) VALUES (?, datetime('now'))",
(name,),
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
PhaseStepResult,
PhaseExecutionError,
)
from .frequency_tuning import FrequencyTuningLimits, FrequencyTuningPhase
from .piezo_pre_rf import PiezoPreRFPhase
from .ssa_char import SSACharPhase

Expand All @@ -19,6 +20,8 @@
"PhaseResult",
"PhaseStepResult",
"PhaseExecutionError",
"FrequencyTuningLimits",
"FrequencyTuningPhase",
"PiezoPreRFPhase",
"SSACharPhase",
]
Loading
Loading