-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
160 lines (114 loc) · 2.95 KB
/
app.py
File metadata and controls
160 lines (114 loc) · 2.95 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import marimo
__generated_with = "0.13.15"
app = marimo.App()
@app.cell
def _():
from henry import Henry
from hippometa import BeamMetadata, MapSet
return BeamMetadata, Henry, MapSet
@app.cell
def _():
beam_file = "act_dr6.02_daytime_beams.tar.gz"
map_file = "act-planck_dr4dr6_coadd_AA_daynight_f090_map.fits"
return beam_file, map_file
@app.cell
def _(Henry):
henry = Henry()
return (henry,)
@app.cell
def _(BeamMetadata, beam_file, henry):
beam_product = henry.new_product(
name="Daynight Beam (DR6)",
description="The beam for DR6 products",
metadata=BeamMetadata(),
sources={"data": {"path": beam_file, "description": "Beam"}},
)
return (beam_product,)
@app.cell
def _(MapSet):
MapSet.valid_slugs
return
@app.cell
def _(MapSet, henry, map_file):
map_product = henry.new_product(
name="ACTxPlanck DR6 f090 coadd map",
description="One of the many coadd maps",
metadata=MapSet.from_fits(filename=map_file),
sources={"map": {"path": map_file, "description": "actxplanck coadd"}},
)
return (map_product,)
@app.cell
def _(map_product):
print(map_product.metadata)
return
@app.cell
def _(map_product):
print(map_product.metadata)
return
@app.cell
def _(beam_product, henry, map_product):
collection = henry.new_collection(
name="Some ACT DR6 Products",
description="A beam and a map from DR6",
products=[map_product, beam_product],
)
return (collection,)
@app.cell
def _(collection):
print(collection)
return
@app.cell
def _(collection, henry):
henry.push(collection)
return
@app.cell
def _(henry, map_product):
remote = henry.pull_product(
product_id=map_product.product_id, realize_sources=False
)
return (remote,)
@app.cell
def _(remote):
print(remote)
return
@app.cell
def _(henry, map_product):
revision = henry.pull_product(
product_id=map_product.product_id, realize_sources=False
).create_revision(major=True)
return (revision,)
@app.cell
def _(revision):
print(revision.revision_of)
return
@app.cell
def _(map_product, revision):
second_map = "act-planck_dr4dr6_coadd_AA_daynight_f150_map.fits"
revision.name = "ACTxPlanck DR6 f150 coadd map"
revision.metadata = map_product.metadata.model_copy()
revision.metadata.frequency = "150"
revision["map"] = second_map
revision["map"].description = "actxplanck coadd"
return
@app.cell
def _(revision):
print(revision)
return
@app.cell
def _(henry, revision):
henry.push(revision)
return
@app.cell
def _(henry, revision):
realized_product = henry.pull_product(product_id=revision.product_id)
return (realized_product,)
@app.cell
def _(realized_product):
for slug, source in realized_product.items():
print(slug, source.path)
return
@app.cell
def _():
return
if __name__ == "__main__":
app.run()