-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
103 lines (91 loc) · 3.61 KB
/
main.py
File metadata and controls
103 lines (91 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
from __future__ import annotations
from tcrb.analysis import analyze_t_crb_aavso_archive, detect_precursor_state
from tcrb.loader import AAVSOLoader, summarize_alias_matches
from tcrb.service import build_monitoring_snapshot, build_target_profile
def main() -> None:
target_name = "T CrB"
asas_sn_id = "137439769436"
vsx_oid = 10602
profile = build_target_profile(
target_name=target_name,
asas_sn_id=asas_sn_id,
vsx_oid=vsx_oid,
)
snapshot = build_monitoring_snapshot(
target_name=target_name,
asas_sn_id=asas_sn_id,
)
print(f"Target: {profile.canonical_name}")
print("")
print("Target Profile")
print(f" canonical_auid: {profile.canonical_auid}")
print(f" vsx_oid: {profile.vsx_oid}")
print(f" alias_count: {len(profile.aliases)}")
print(f" aliases_sample: {profile.aliases[:8]}")
print("")
print("Source Metadata")
print(
f" VSP chart_id: {profile.vsp.chart_id if profile.vsp is not None else None}"
)
print(
" VSP comparison_star_count: "
f"{len(profile.vsp.comparison_stars) if profile.vsp is not None else 0}"
)
print(
f" VSX observation_count: {profile.vsx.observation_count if profile.vsx is not None else None}"
)
print(
f" VSX period_days: {profile.vsx.period_days if profile.vsx is not None else None}"
)
print(
f" SIMBAD object_type: {profile.simbad.object_type if profile.simbad is not None else None}"
)
print(
" SIMBAD coordinates: "
f"{profile.simbad.ra_hms if profile.simbad is not None else None} "
f"{profile.simbad.dec_dms if profile.simbad is not None else None}"
)
print("")
print("Monitoring Snapshot")
print(f" target_record_count: {len(snapshot.target_records)}")
if snapshot.target_records:
print(f" first_target_record: {snapshot.target_records[0]}")
if snapshot.series_summary is not None:
print(f" light_curve_point_count: {snapshot.series_summary.point_count}")
print(f" light_curve_filters: {snapshot.series_summary.unique_filters}")
print(f" latest_time_label: {snapshot.series_summary.latest_time_label}")
print(f" latest_mag: {snapshot.series_summary.latest_mag}")
if snapshot.light_curve_error is not None:
print(f" light_curve_error: {snapshot.light_curve_error}")
print("")
print("AAVSO Archive")
aavso_loader = AAVSOLoader(
"data/aavso_1866_2026.txt", alias_catalog=profile.alias_catalog
)
aavso_frame = aavso_loader.load_dataframe()
print(f" record_count: {aavso_frame.height}")
if not aavso_frame.is_empty():
print(f" alias_match_counts: {summarize_alias_matches(aavso_frame)}")
print(f" first_record: {aavso_frame.row(0, named=True)}")
print(f" last_record: {aavso_frame.row(aavso_frame.height - 1, named=True)}")
print("")
study = analyze_t_crb_aavso_archive(
"data/aavso_1866_2026.txt",
alias_catalog=profile.alias_catalog,
)
decision = detect_precursor_state(study)
print("Precursor Decision")
print(f" level: {decision.level}")
print(f" rationale: {decision.rationale}")
for assessment in decision.assessments:
print(
" signal="
f"{assessment.signal} "
f"z_ratio={assessment.robust_zscore_ratio} "
f"cusum_ratio={assessment.cusum_ratio} "
f"warning={assessment.triggered_warning} "
f"candidate={assessment.triggered_candidate} "
f"strong={assessment.triggered_strong}"
)
if __name__ == "__main__":
main()