ptr-editor 0.4.1__tar.gz → 0.4.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/PKG-INFO +1 -1
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/pyproject.toml +1 -1
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/apl/elements.py +9 -2
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/__init__.py +0 -2
- ptr_editor-0.4.1/src/ptr_editor/elements/offset_builder.py +0 -377
- ptr_editor-0.4.1/src/ptr_editor/spice_accessors/eval_offpointing.py +0 -1109
- ptr_editor-0.4.1/src/ptr_editor/spice_accessors/eval_slew.py +0 -349
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/.gitignore +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/LICENSE +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/README.md +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/README.md +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/base_element.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/converter_factory.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/decorators.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/decorators_utils.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/field_transformer.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/fields.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/inspect.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/protocols.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/sentinels.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/type_utils.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/core/validator_factory.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/elements_registry.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/formatting.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/globals.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/pandas.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/resolution/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/resolution/registry.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/resolution/strategies.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/xml/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/xml/converter.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/xml/converters.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/xml/custom_disambiguator.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/xml/io.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/xml/lxml_adapter.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/attrs_xml/xml/utils.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/apl/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/apl/jsoc-apl-schema.json +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/base.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/diffing.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/itl/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/itl/elements.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/itl/jsoc-itl-schema.json +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/opl/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/opl/csv.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/opl/elements.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/opl/jsoc-opl-schema.json +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/schema.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_jsoc/utils.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/juice_opl/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_cli/README.md +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_cli/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_cli/commands/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_cli/commands/validate.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_cli/commands/version.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_cli/main.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_compare/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/accessors/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/accessors/accessor.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/accessors/attrs_dict_accessor.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/agm_config/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/agm_config/agm_config.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/agm_config/agm_utils.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/agm_config/html.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/agm_validator/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/agm_validator/agm_config_validator.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/context/README.md +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/context/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/context/defaults.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/context/presets.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/context/service_config.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/context/services.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/core/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/core/codenames_gen.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/core/logging.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/core/ptr_element.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/core/tree_utils.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/data/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/data/snippets.txt +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/diffing/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/diffing/diff_report.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/diffing/matcher.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/diffing/text_diff_result.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/diffing/timeline_differ_simple.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/diffing/visualize.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/additional_elements.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/agm_config.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/array.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/attitude.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/blocks.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/directions.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/doc.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/metadata.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/offset.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/phase_angle.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/ref_typed_mixin.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/surface.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/timeline.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/units.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements/values.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/elements_extractor/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/extra/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/extra/add_block_comments.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/factory/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/factory/attitudes.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/factory/blocks.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/generators/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/generators/base.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/generators/generators.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/generators/processor.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/html.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/io/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/io/ptr_converter_setup.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/io/simplified_converter.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/io/simplified_converter2.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/io/xml_formatting.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/py.typed +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/services/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/services/quick_access.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/services/resolution_strategies.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/spice_accessors/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/spice_accessors/directions.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/spice_accessors/eval_directions.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/templates/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/templates/html.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/templates/register.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/templates/template.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/README.md +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/combinators.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/html.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/ptr_validators.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/result.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/ruleset_registry.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/runner.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/validation/validator.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/versioned_file_manager/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/versioned_file_manager/file_info.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/versioned_file_manager/html.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_editor/versioned_file_manager/manager.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_solver/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_solver/cached_solver.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_solver/ptr_solver.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/ptr_solver/solvable_mixin.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/__init__.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/config.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/interface.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/merging.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/opl.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/ops.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/plot.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/segment_mixin.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/segments_collection_mixin.py +0 -0
- {ptr_editor-0.4.1 → ptr_editor-0.4.2}/src/time_segments/utils.py +0 -0
|
@@ -635,14 +635,21 @@ class ActivityPlan(AplBaseItem, SegmentsCollectionMixin[Activity]):
|
|
|
635
635
|
|
|
636
636
|
|
|
637
637
|
def _format_apl_duration(td: pd.Timedelta) -> str:
|
|
638
|
-
"""Format a Timedelta as ``ddd.hh:mm:ss[.SSS]`` for the APL duration field.
|
|
638
|
+
"""Format a Timedelta as ``[−]ddd.hh:mm:ss[.SSS]`` for the APL duration field.
|
|
639
639
|
|
|
640
640
|
The APL schema pattern for *duration* is:
|
|
641
641
|
``^\\d{1,3}\\.\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,3})?$``
|
|
642
642
|
|
|
643
643
|
Unlike the OPL / XML format (which uses a leading sign), APL duration
|
|
644
644
|
always starts with a three-digit (or fewer) day count followed by a dot.
|
|
645
|
+
Negative durations are represented by negating the Timedelta first so that
|
|
646
|
+
all components are derived from the absolute value, then prepending ``-``.
|
|
645
647
|
"""
|
|
648
|
+
if td.total_seconds() < 0:
|
|
649
|
+
sign = "-"
|
|
650
|
+
td = -td
|
|
651
|
+
else:
|
|
652
|
+
sign = ""
|
|
646
653
|
total_seconds = int(td.total_seconds())
|
|
647
654
|
milliseconds = int(td.microseconds // 1000) if td.microseconds else 0
|
|
648
655
|
days = total_seconds // 86400
|
|
@@ -651,7 +658,7 @@ def _format_apl_duration(td: pd.Timedelta) -> str:
|
|
|
651
658
|
remainder = remainder % 3600
|
|
652
659
|
minutes = remainder // 60
|
|
653
660
|
seconds = remainder % 60
|
|
654
|
-
base = f"{days:03d}.{hours:02d}:{minutes:02d}:{seconds:02d}"
|
|
661
|
+
base = f"{sign}{days:03d}.{hours:02d}:{minutes:02d}:{seconds:02d}"
|
|
655
662
|
if milliseconds:
|
|
656
663
|
return f"{base}.{milliseconds:03d}"
|
|
657
664
|
return base
|
|
@@ -85,7 +85,6 @@ from .offset import (
|
|
|
85
85
|
RasterOffsetAngles,
|
|
86
86
|
ScanOffsetAngles,
|
|
87
87
|
)
|
|
88
|
-
from .offset_builder import MeridianStareBuilder
|
|
89
88
|
|
|
90
89
|
# Phase angle elements
|
|
91
90
|
from .phase_angle import (
|
|
@@ -179,7 +178,6 @@ __all__ = [
|
|
|
179
178
|
# Offsets
|
|
180
179
|
"CustomOffsetAngles",
|
|
181
180
|
"FixedOffsetAngles",
|
|
182
|
-
"MeridianStareBuilder",
|
|
183
181
|
"OffsetAngles",
|
|
184
182
|
"RasterOffsetAngles",
|
|
185
183
|
"ScanOffsetAngles",
|
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
"""Builder for stare-and-slew CustomOffsetAngles patterns.
|
|
2
|
-
|
|
3
|
-
Simplifies construction of :class:`~ptr_editor.elements.offset.CustomOffsetAngles`
|
|
4
|
-
for meridian-scan observation patterns: a sequence of stares at fixed Y-offset
|
|
5
|
-
positions connected by constant-velocity slews.
|
|
6
|
-
|
|
7
|
-
Knot structure
|
|
8
|
-
--------------
|
|
9
|
-
For each stare position ``y_i`` followed by a transition to ``y_{i+1}``:
|
|
10
|
-
|
|
11
|
-
1. **Dwell** — two knots at ``y_i``, rate = 0, duration = ``dwell_time``.
|
|
12
|
-
The Hermite polynomial is flat (zero displacement, zero velocity).
|
|
13
|
-
|
|
14
|
-
2. **Pre-slew ramp** — one knot still at ``y_i``, rate = ``v``,
|
|
15
|
-
duration = ``trans_time``.
|
|
16
|
-
Because both endpoint Y values are identical the **net displacement is
|
|
17
|
-
exactly zero** regardless of the intermediate profile. The spacecraft
|
|
18
|
-
builds scan velocity while nominally holding the dwell angle; a small
|
|
19
|
-
transient dip of magnitude ≈ ``v · trans_time · 4/27`` is present but
|
|
20
|
-
is typically within pointing tolerance.
|
|
21
|
-
|
|
22
|
-
3. **Constant-velocity slew** — one knot at
|
|
23
|
-
``y_slew_end = y_i + v · slew_time``, rate = ``v``,
|
|
24
|
-
duration = ``slew_time``.
|
|
25
|
-
Both endpoint rates equal ``Δy / Δt`` so the Hermite polynomial
|
|
26
|
-
is exactly linear (pure constant-velocity motion).
|
|
27
|
-
|
|
28
|
-
4. **Post-decel ramp** — one knot at ``y_{i+1}``, rate = 0,
|
|
29
|
-
duration = ``trans_time``.
|
|
30
|
-
Smooth ease-out that lands exactly on the next dwell position.
|
|
31
|
-
``delta_decel = y_{i+1} − y_slew_end`` can be small positive (slew stops
|
|
32
|
-
just short of target) or slightly negative (mild overshoot corrected
|
|
33
|
-
during ramp).
|
|
34
|
-
|
|
35
|
-
Example — reproducing the MAJ_G-RS-SEG_TGT_RASTER_001 pattern::
|
|
36
|
-
|
|
37
|
-
builder = MeridianStareBuilder(
|
|
38
|
-
stare_y_angles=[-4.87, -3.57, -2.30, -1.06, +0.155, +1.35, +2.52],
|
|
39
|
-
dwell_time=90.0,
|
|
40
|
-
slew_velocity=0.0055, # deg/sec
|
|
41
|
-
slew_time=225.0, # sec → covers 0.0055 × 225 = 1.2375 deg
|
|
42
|
-
trans_time=60.0,
|
|
43
|
-
start_time="2033-11-27T10:01:30",
|
|
44
|
-
)
|
|
45
|
-
offset_angles = builder.build()
|
|
46
|
-
|
|
47
|
-
See Also
|
|
48
|
-
--------
|
|
49
|
-
:class:`~ptr_editor.elements.offset.CustomOffsetAngles`
|
|
50
|
-
"""
|
|
51
|
-
|
|
52
|
-
from __future__ import annotations
|
|
53
|
-
|
|
54
|
-
from dataclasses import dataclass, field
|
|
55
|
-
from typing import TYPE_CHECKING
|
|
56
|
-
|
|
57
|
-
import numpy as np
|
|
58
|
-
import pandas as pd
|
|
59
|
-
|
|
60
|
-
from attrs_xml.core.sentinels import UNSET
|
|
61
|
-
|
|
62
|
-
from ptr_editor.elements.array import AnglesVector, AngularVelocityVector, TimesVector
|
|
63
|
-
from ptr_editor.elements.offset import CustomOffsetAngles
|
|
64
|
-
|
|
65
|
-
if TYPE_CHECKING:
|
|
66
|
-
pass
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
# ---------------------------------------------------------------------------
|
|
70
|
-
# Public builder
|
|
71
|
-
# ---------------------------------------------------------------------------
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
@dataclass
|
|
75
|
-
class MeridianStareBuilder:
|
|
76
|
-
"""Build :class:`~ptr_editor.elements.offset.CustomOffsetAngles` for a
|
|
77
|
-
stare-and-slew pattern along the Y offset axis.
|
|
78
|
-
|
|
79
|
-
Parameters
|
|
80
|
-
----------
|
|
81
|
-
stare_y_angles:
|
|
82
|
-
Y-offset dwell angles in **degrees**, one per stare position.
|
|
83
|
-
At least two values are required.
|
|
84
|
-
dwell_time:
|
|
85
|
-
Duration of each stare in **seconds**.
|
|
86
|
-
slew_velocity:
|
|
87
|
-
Magnitude of the constant-velocity scan in **deg/sec** (positive).
|
|
88
|
-
The sign is inferred from the direction between consecutive stares.
|
|
89
|
-
slew_time:
|
|
90
|
-
Duration of the constant-velocity phase in **seconds**.
|
|
91
|
-
During this phase the spacecraft moves exactly
|
|
92
|
-
``slew_velocity × slew_time`` degrees.
|
|
93
|
-
trans_time:
|
|
94
|
-
Duration of each acceleration/deceleration ramp in **seconds**.
|
|
95
|
-
Default: 60 s.
|
|
96
|
-
x_angle:
|
|
97
|
-
Constant X-offset angle in **degrees** applied throughout.
|
|
98
|
-
Default: 0.
|
|
99
|
-
start_time:
|
|
100
|
-
Start time of the first stare. Accepts any value accepted by
|
|
101
|
-
``pd.Timestamp``. If *None* the
|
|
102
|
-
:attr:`CustomOffsetAngles.start_time` will be left as ``UNSET``
|
|
103
|
-
and must be assigned before the object is used.
|
|
104
|
-
|
|
105
|
-
Notes
|
|
106
|
-
-----
|
|
107
|
-
The net displacement during each pre-slew ramp is *always* zero because
|
|
108
|
-
the Hermite polynomial shares the same Y value at both endpoints. The
|
|
109
|
-
post-decel ramp may have a small positive or negative residual
|
|
110
|
-
(``delta_decel``) depending on how ``slew_velocity × slew_time``
|
|
111
|
-
compares with the actual step spacing:
|
|
112
|
-
|
|
113
|
-
* ``delta_decel > 0`` — slew stops slightly short, ramp covers remainder.
|
|
114
|
-
* ``delta_decel < 0`` — slew mildly overshoots, ramp corrects back.
|
|
115
|
-
Inspect :meth:`transition_info` to check magnitudes.
|
|
116
|
-
"""
|
|
117
|
-
|
|
118
|
-
stare_y_angles: list[float]
|
|
119
|
-
dwell_time: float
|
|
120
|
-
slew_velocity: float
|
|
121
|
-
slew_time: float
|
|
122
|
-
trans_time: float = 60.0
|
|
123
|
-
x_angle: float = 0.0
|
|
124
|
-
start_time: pd.Timestamp | str | None = None
|
|
125
|
-
|
|
126
|
-
# ------------------------------------------------------------------
|
|
127
|
-
# Derived helpers
|
|
128
|
-
# ------------------------------------------------------------------
|
|
129
|
-
|
|
130
|
-
@property
|
|
131
|
-
def n_stares(self) -> int:
|
|
132
|
-
"""Number of stare positions."""
|
|
133
|
-
return len(self.stare_y_angles)
|
|
134
|
-
|
|
135
|
-
@property
|
|
136
|
-
def total_duration(self) -> float:
|
|
137
|
-
"""Total duration of the generated offset profile in **seconds**.
|
|
138
|
-
|
|
139
|
-
Equals the sum of all delta-times produced by :meth:`build`.
|
|
140
|
-
"""
|
|
141
|
-
n = self.n_stares
|
|
142
|
-
if n == 0:
|
|
143
|
-
return 0.0
|
|
144
|
-
# Each complete "stare+transition" block (all but last):
|
|
145
|
-
# dwell (1×) + trans + slew + trans = dwell + 2×trans + slew
|
|
146
|
-
# Plus the final dwell which only contributes 1 dwell_time.
|
|
147
|
-
n_transitions = n - 1
|
|
148
|
-
return (
|
|
149
|
-
n * self.dwell_time
|
|
150
|
-
+ n_transitions * (2 * self.trans_time + self.slew_time)
|
|
151
|
-
)
|
|
152
|
-
|
|
153
|
-
# ------------------------------------------------------------------
|
|
154
|
-
# Transition introspection
|
|
155
|
-
# ------------------------------------------------------------------
|
|
156
|
-
|
|
157
|
-
def transition_info(self) -> list[dict]:
|
|
158
|
-
"""Return a list of dicts describing each stare-to-stare transition.
|
|
159
|
-
|
|
160
|
-
Each dict contains:
|
|
161
|
-
|
|
162
|
-
* ``i`` — transition index (0-based)
|
|
163
|
-
* ``y_from`` — current dwell Y angle (deg)
|
|
164
|
-
* ``y_to`` — next dwell Y angle (deg)
|
|
165
|
-
* ``step`` — total Y displacement (deg)
|
|
166
|
-
* ``v_slew`` — signed constant-velocity scan speed (deg/sec)
|
|
167
|
-
* ``slew_covers`` — distance covered during constant-velocity phase (deg)
|
|
168
|
-
* ``y_slew_end`` — Y angle at end of constant-velocity slew (deg)
|
|
169
|
-
* ``delta_decel`` — post-decel displacement ``y_to − y_slew_end`` (deg)
|
|
170
|
-
* ``overshoot`` — True when the slew goes slightly past ``y_to``
|
|
171
|
-
"""
|
|
172
|
-
info = []
|
|
173
|
-
for i in range(self.n_stares - 1):
|
|
174
|
-
y_from = self.stare_y_angles[i]
|
|
175
|
-
y_to = self.stare_y_angles[i + 1]
|
|
176
|
-
step = y_to - y_from
|
|
177
|
-
v = float(np.sign(step)) * abs(self.slew_velocity)
|
|
178
|
-
slew_covers = v * self.slew_time
|
|
179
|
-
y_slew_end = y_from + slew_covers
|
|
180
|
-
delta_decel = y_to - y_slew_end
|
|
181
|
-
info.append(
|
|
182
|
-
{
|
|
183
|
-
"i": i,
|
|
184
|
-
"y_from": y_from,
|
|
185
|
-
"y_to": y_to,
|
|
186
|
-
"step": step,
|
|
187
|
-
"v_slew": v,
|
|
188
|
-
"slew_covers": slew_covers,
|
|
189
|
-
"y_slew_end": y_slew_end,
|
|
190
|
-
"delta_decel": delta_decel,
|
|
191
|
-
"overshoot": delta_decel * step < 0,
|
|
192
|
-
}
|
|
193
|
-
)
|
|
194
|
-
return info
|
|
195
|
-
|
|
196
|
-
def summary(self) -> str:
|
|
197
|
-
"""Return a human-readable summary of the scan pattern."""
|
|
198
|
-
lines = [
|
|
199
|
-
f"MeridianStareBuilder — {self.n_stares} stares",
|
|
200
|
-
f" dwell_time : {self.dwell_time:.1f} s",
|
|
201
|
-
f" slew_velocity: {self.slew_velocity:.5f} deg/s",
|
|
202
|
-
f" slew_time : {self.slew_time:.1f} s → "
|
|
203
|
-
f"{self.slew_velocity * self.slew_time:.4f} deg at const. v",
|
|
204
|
-
f" trans_time : {self.trans_time:.1f} s "
|
|
205
|
-
f"(pre-accel dip ≈ {self.slew_velocity * self.trans_time * 4 / 27:.4f} deg)",
|
|
206
|
-
f" x_angle : {self.x_angle:.4f} deg",
|
|
207
|
-
f" total duration: {self.total_duration:.1f} s "
|
|
208
|
-
f"({self.total_duration / 60:.2f} min)",
|
|
209
|
-
"",
|
|
210
|
-
" Transitions:",
|
|
211
|
-
]
|
|
212
|
-
for t in self.transition_info():
|
|
213
|
-
flag = " ⚠ overshoot" if t["overshoot"] else ""
|
|
214
|
-
lines.append(
|
|
215
|
-
f" [{t['i']}] {t['y_from']:+.4f} → {t['y_to']:+.4f} deg"
|
|
216
|
-
f" (Δ={t['step']:+.4f}, slew {t['slew_covers']:+.4f},"
|
|
217
|
-
f" decel {t['delta_decel']:+.4f}){flag}"
|
|
218
|
-
)
|
|
219
|
-
return "\n".join(lines)
|
|
220
|
-
|
|
221
|
-
# ------------------------------------------------------------------
|
|
222
|
-
# Core builder
|
|
223
|
-
# ------------------------------------------------------------------
|
|
224
|
-
|
|
225
|
-
def build(self) -> CustomOffsetAngles:
|
|
226
|
-
"""Construct and return the :class:`~ptr_editor.elements.offset.CustomOffsetAngles`.
|
|
227
|
-
|
|
228
|
-
The resulting knot sequence covers the full stare-and-slew pattern
|
|
229
|
-
starting from the first stare and ending at the last dwell position.
|
|
230
|
-
|
|
231
|
-
Raises
|
|
232
|
-
------
|
|
233
|
-
ValueError
|
|
234
|
-
If fewer than 2 stare positions are provided or if
|
|
235
|
-
``slew_velocity`` is zero.
|
|
236
|
-
"""
|
|
237
|
-
if self.n_stares < 2:
|
|
238
|
-
msg = (
|
|
239
|
-
"MeridianStareBuilder requires at least 2 stare positions; "
|
|
240
|
-
f"got {self.n_stares}."
|
|
241
|
-
)
|
|
242
|
-
raise ValueError(msg)
|
|
243
|
-
if self.slew_velocity == 0.0:
|
|
244
|
-
msg = "slew_velocity must be non-zero."
|
|
245
|
-
raise ValueError(msg)
|
|
246
|
-
|
|
247
|
-
dts: list[float] = []
|
|
248
|
-
xs: list[float] = []
|
|
249
|
-
ys: list[float] = []
|
|
250
|
-
vxs: list[float] = []
|
|
251
|
-
vys: list[float] = []
|
|
252
|
-
|
|
253
|
-
def _add(dt: float, y: float, vy: float) -> None:
|
|
254
|
-
dts.append(dt)
|
|
255
|
-
xs.append(self.x_angle)
|
|
256
|
-
ys.append(y)
|
|
257
|
-
vxs.append(0.0)
|
|
258
|
-
vys.append(vy)
|
|
259
|
-
|
|
260
|
-
# First stare: two dwell knots
|
|
261
|
-
# dt=0 → first knot is exactly at start_time
|
|
262
|
-
# dt=dwell_time → end of first dwell (flat Hermite segment)
|
|
263
|
-
_add(0.0, self.stare_y_angles[0], 0.0)
|
|
264
|
-
_add(self.dwell_time, self.stare_y_angles[0], 0.0)
|
|
265
|
-
|
|
266
|
-
for i in range(self.n_stares - 1):
|
|
267
|
-
y_curr = self.stare_y_angles[i]
|
|
268
|
-
y_next = self.stare_y_angles[i + 1]
|
|
269
|
-
|
|
270
|
-
# Signed constant scan velocity for this leg
|
|
271
|
-
v = float(np.sign(y_next - y_curr)) * abs(self.slew_velocity)
|
|
272
|
-
y_slew_end = y_curr + v * self.slew_time
|
|
273
|
-
|
|
274
|
-
# (a) Pre-slew ramp — same y as dwell, velocity builds 0 → v
|
|
275
|
-
# Net Y displacement = 0 (identical endpoint values guarantee this).
|
|
276
|
-
_add(self.trans_time, y_curr, v)
|
|
277
|
-
|
|
278
|
-
# (b) Constant-velocity slew — rates at both ends equal v = Δy/Δt
|
|
279
|
-
# so the Hermite polynomial is exactly linear.
|
|
280
|
-
_add(self.slew_time, y_slew_end, v)
|
|
281
|
-
|
|
282
|
-
# (c) Post-decel ramp — smooth ease-out landing at y_next
|
|
283
|
-
# This knot also serves as the dwell-start of the next stare.
|
|
284
|
-
_add(self.trans_time, y_next, 0.0)
|
|
285
|
-
|
|
286
|
-
# (d) Dwell end for non-final stares
|
|
287
|
-
if i < self.n_stares - 2:
|
|
288
|
-
_add(self.dwell_time, y_next, 0.0)
|
|
289
|
-
|
|
290
|
-
# Final stare dwell-end knot
|
|
291
|
-
_add(self.dwell_time, self.stare_y_angles[-1], 0.0)
|
|
292
|
-
|
|
293
|
-
# Resolve start_time
|
|
294
|
-
if self.start_time is None:
|
|
295
|
-
resolved_start = UNSET
|
|
296
|
-
else:
|
|
297
|
-
resolved_start = pd.Timestamp(self.start_time)
|
|
298
|
-
|
|
299
|
-
return CustomOffsetAngles(
|
|
300
|
-
start_time=resolved_start,
|
|
301
|
-
delta_times=TimesVector(values=np.array(dts), units="sec"),
|
|
302
|
-
x_angles=AnglesVector(values=np.array(xs), units="deg"),
|
|
303
|
-
x_rates=AngularVelocityVector(values=np.array(vxs), units="deg/sec"),
|
|
304
|
-
y_angles=AnglesVector(values=np.array(ys), units="deg"),
|
|
305
|
-
y_rates=AngularVelocityVector(values=np.array(vys), units="deg/sec"),
|
|
306
|
-
)
|
|
307
|
-
|
|
308
|
-
# ------------------------------------------------------------------
|
|
309
|
-
# Convenience constructors
|
|
310
|
-
# ------------------------------------------------------------------
|
|
311
|
-
|
|
312
|
-
@classmethod
|
|
313
|
-
def from_even_spacing(
|
|
314
|
-
cls,
|
|
315
|
-
n_stares: int,
|
|
316
|
-
y_start: float,
|
|
317
|
-
y_spacing: float,
|
|
318
|
-
dwell_time: float,
|
|
319
|
-
slew_velocity: float,
|
|
320
|
-
trans_time: float = 60.0,
|
|
321
|
-
x_angle: float = 0.0,
|
|
322
|
-
start_time: pd.Timestamp | str | None = None,
|
|
323
|
-
slew_time_fraction: float = 0.9,
|
|
324
|
-
) -> "MeridianStareBuilder":
|
|
325
|
-
"""Create a builder for a uniformly-spaced meridian scan.
|
|
326
|
-
|
|
327
|
-
Parameters
|
|
328
|
-
----------
|
|
329
|
-
n_stares:
|
|
330
|
-
Number of stare positions.
|
|
331
|
-
y_start:
|
|
332
|
-
Y angle of the first stare in **degrees**.
|
|
333
|
-
y_spacing:
|
|
334
|
-
Step between consecutive stares in **degrees** (may be negative
|
|
335
|
-
for a descending scan).
|
|
336
|
-
dwell_time:
|
|
337
|
-
Stare duration in **seconds**.
|
|
338
|
-
slew_velocity:
|
|
339
|
-
Desired scan speed in **deg/sec** (positive; sign inferred from
|
|
340
|
-
``y_spacing``).
|
|
341
|
-
trans_time:
|
|
342
|
-
Ramp duration in **seconds**. Default: 60 s.
|
|
343
|
-
x_angle:
|
|
344
|
-
Constant X offset in **degrees**. Default: 0.
|
|
345
|
-
start_time:
|
|
346
|
-
Optional start time.
|
|
347
|
-
slew_time_fraction:
|
|
348
|
-
Fraction of the available travel distance covered at constant
|
|
349
|
-
velocity. The constant-velocity phase covers
|
|
350
|
-
``|y_spacing| × slew_time_fraction`` degrees, which gives
|
|
351
|
-
``slew_time = |y_spacing| × slew_time_fraction / slew_velocity``.
|
|
352
|
-
Must be in ``(0, 1]``. Default: 0.9 (10 % reserved for
|
|
353
|
-
post-decel ramp).
|
|
354
|
-
|
|
355
|
-
Returns
|
|
356
|
-
-------
|
|
357
|
-
MeridianStareBuilder
|
|
358
|
-
"""
|
|
359
|
-
if not (0 < slew_time_fraction <= 1.0):
|
|
360
|
-
msg = "slew_time_fraction must be in (0, 1]."
|
|
361
|
-
raise ValueError(msg)
|
|
362
|
-
|
|
363
|
-
stare_y_angles = [
|
|
364
|
-
y_start + i * y_spacing for i in range(n_stares)
|
|
365
|
-
]
|
|
366
|
-
slew_distance = abs(y_spacing) * slew_time_fraction
|
|
367
|
-
slew_time = slew_distance / slew_velocity
|
|
368
|
-
|
|
369
|
-
return cls(
|
|
370
|
-
stare_y_angles=stare_y_angles,
|
|
371
|
-
dwell_time=dwell_time,
|
|
372
|
-
slew_velocity=slew_velocity,
|
|
373
|
-
slew_time=slew_time,
|
|
374
|
-
trans_time=trans_time,
|
|
375
|
-
x_angle=x_angle,
|
|
376
|
-
start_time=start_time,
|
|
377
|
-
)
|