microlens-submit 0.12.1__py3-none-any.whl

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.
@@ -0,0 +1,163 @@
1
+ """microlens-submit: A stateful submission toolkit for the Microlensing Data Challenge.
2
+
3
+ This package provides a comprehensive toolkit for managing and submitting microlensing
4
+ data challenge solutions. It offers both programmatic API access and command-line
5
+ interface for creating, validating, and exporting microlensing submissions.
6
+
7
+ **Core Features:**
8
+ - Project initialization and management
9
+ - Solution creation and parameter validation
10
+ - Submission validation and completeness checking
11
+ - HTML dossier generation with rich visualizations
12
+ - Export functionality for challenge submission
13
+ - Command-line interface for all operations
14
+
15
+ **Main Components:**
16
+ - Submission: Top-level container for all submission data
17
+ - Event: Container for microlensing events and their solutions
18
+ - Solution: Individual microlensing solutions with parameters and metadata
19
+ - Validation: Comprehensive parameter and submission validation
20
+ - Dossier: HTML report generation with Tailwind CSS styling
21
+
22
+ **Quick Start:**
23
+ >>> from microlens_submit import load, Submission
24
+ >>>
25
+ >>> # Load an existing project
26
+ >>> submission = load("./my_project")
27
+ >>>
28
+ >>> # Or create a new submission
29
+ >>> submission = Submission()
30
+ >>> submission.team_name = "Team Alpha"
31
+ >>> submission.tier = "advanced"
32
+ >>> submission.save("./my_project")
33
+ >>>
34
+ >>> # Add a solution to an event
35
+ >>> event = submission.get_event("EVENT001")
36
+ >>> solution = event.add_solution(
37
+ ... model_type="1S1L",
38
+ ... parameters={"t0": 2459123.5, "u0": 0.1, "tE": 20.0}
39
+ ... )
40
+ >>> solution.log_likelihood = -1234.56
41
+ >>> solution.cpu_hours = 2.5
42
+ >>> submission.save()
43
+
44
+ **Command Line Usage:**
45
+ # Initialize a new project
46
+ microlens-submit init --team-name "Team Alpha" --tier "advanced" ./project
47
+
48
+ # Add a solution
49
+ microlens-submit add-solution EVENT001 1S1L ./project \
50
+ --param t0=2459123.5 --param u0=0.1 --param tE=20.0 \
51
+ --log-likelihood -1234.56 --cpu-hours 2.5
52
+
53
+ # Validate and generate dossier
54
+ microlens-submit validate-submission ./project
55
+ microlens-submit generate-dossier ./project
56
+
57
+ # Export for submission
58
+ microlens-submit export submission.zip ./project
59
+
60
+ **Supported Model Types:**
61
+ - 1S1L: Point Source, Single Point Lens (standard microlensing)
62
+ - 1S2L: Point Source, Binary Point Lens
63
+ - 2S1L: Binary Source, Single Point Lens
64
+ - 2S2L: Binary Source, Binary Point Lens
65
+ - 1S3L: Point Source, Triple Point Lens
66
+ - 2S3L: Binary Source, Triple Point Lens
67
+
68
+ **Higher-Order Effects:**
69
+ - parallax: Microlens parallax effect
70
+ - finite-source: Finite source size effect
71
+ - lens-orbital-motion: Orbital motion of lens components
72
+ - xallarap: Source orbital motion
73
+ - gaussian-process: Gaussian process noise modeling
74
+ - stellar-rotation: Stellar rotation effects
75
+ - fitted-limb-darkening: Fitted limb darkening coefficients
76
+
77
+ Example:
78
+ >>> from microlens_submit import load, Submission
79
+ >>> from pathlib import Path
80
+ >>>
81
+ >>> # Create a new submission project
82
+ >>> submission = Submission()
83
+ >>> submission.team_name = "Team Alpha"
84
+ >>> submission.tier = "advanced"
85
+ >>> submission.repo_url = "https://github.com/team-alpha/microlens-analysis"
86
+ >>>
87
+ >>> # Add hardware information
88
+ >>> submission.hardware_info = {
89
+ ... "cpu_details": "Intel Xeon E5-2680 v4",
90
+ ... "memory_gb": 64,
91
+ ... "nexus_image": "roman-science-platform:latest"
92
+ ... }
93
+ >>>
94
+ >>> # Create an event and add solutions
95
+ >>> event = submission.get_event("EVENT001")
96
+ >>>
97
+ >>> # Simple 1S1L solution
98
+ >>> solution1 = event.add_solution(
99
+ ... model_type="1S1L",
100
+ ... parameters={
101
+ ... "t0": 2459123.5,
102
+ ... "u0": 0.1,
103
+ ... "tE": 20.0,
104
+ ... "F0_S": 1000.0,
105
+ ... "F0_B": 500.0
106
+ ... }
107
+ ... )
108
+ >>> solution1.log_likelihood = -1234.56
109
+ >>> solution1.n_data_points = 1250
110
+ >>> solution1.cpu_hours = 2.5
111
+ >>> solution1.relative_probability = 0.8
112
+ >>> solution1.notes = "# Simple Point Lens Fit\n\nThis is a basic 1S1L solution."
113
+ >>>
114
+ >>> # Binary lens solution with parallax
115
+ >>> solution2 = event.add_solution(
116
+ ... model_type="1S2L",
117
+ ... parameters={
118
+ ... "t0": 2459123.5,
119
+ ... "u0": 0.08,
120
+ ... "tE": 22.1,
121
+ ... "s": 1.15,
122
+ ... "q": 0.001,
123
+ ... "alpha": 45.2,
124
+ ... "piEN": 0.1,
125
+ ... "piEE": 0.05,
126
+ ... "F0_S": 1000.0,
127
+ ... "F0_B": 500.0
128
+ ... }
129
+ ... )
130
+ >>> solution2.higher_order_effects = ["parallax"]
131
+ >>> solution2.t_ref = 2459123.0
132
+ >>> solution2.log_likelihood = -1189.34
133
+ >>> solution2.cpu_hours = 15.2
134
+ >>> solution2.relative_probability = 0.2
135
+ >>>
136
+ >>> # Save the submission
137
+ >>> submission.save("./my_submission")
138
+ >>>
139
+ >>> # Validate the submission
140
+ >>> warnings = submission.validate()
141
+ >>> if warnings:
142
+ ... print("Validation warnings:", warnings)
143
+ >>> else:
144
+ ... print("Submission is valid!")
145
+ >>>
146
+ >>> # Generate dossier
147
+ >>> from microlens_submit.dossier import generate_dashboard_html
148
+ >>> generate_dashboard_html(submission, Path("./my_submission/dossier"))
149
+
150
+ Note:
151
+ This package is designed for the Microlensing Data Challenge and provides
152
+ comprehensive tools for managing submission data. All data is stored in
153
+ JSON format for portability and human readability. The package includes
154
+ extensive validation to ensure submission completeness and correctness.
155
+ The HTML dossier generation creates professional, printable reports with
156
+ Tailwind CSS styling and syntax-highlighted markdown notes.
157
+ """
158
+
159
+ __version__ = "0.12.1"
160
+
161
+ from .api import Event, Solution, Submission, load
162
+
163
+ __all__ = ["Event", "Solution", "Submission", "load"]