Spaces:
Running
Running
Commit ·
615125c
1
Parent(s): 85b4f7a
change alignmnet
Browse files- modules/QuickLook/EventList.py +31 -47
modules/QuickLook/EventList.py
CHANGED
|
@@ -292,7 +292,6 @@ def simulate_event_list(
|
|
| 292 |
max_counts_input,
|
| 293 |
dt_input,
|
| 294 |
name_input,
|
| 295 |
-
method_selector,
|
| 296 |
output_box_container,
|
| 297 |
warning_box_container,
|
| 298 |
warning_handler,
|
|
@@ -353,14 +352,10 @@ def simulate_event_list(
|
|
| 353 |
|
| 354 |
# Simulate the light curve
|
| 355 |
times = np.arange(time_bins)
|
| 356 |
-
counts = np.
|
| 357 |
lc = Lightcurve(times, counts, dt=dt, skip_checks=True)
|
| 358 |
|
| 359 |
-
|
| 360 |
-
event_list = EventList.from_lc(lc)
|
| 361 |
-
else:
|
| 362 |
-
event_list = EventList()
|
| 363 |
-
event_list.simulate_times(lc)
|
| 364 |
|
| 365 |
name = name_input.value
|
| 366 |
loaded_event_data.append((name, event_list))
|
|
@@ -541,25 +536,28 @@ def create_simulate_event_list_tab(
|
|
| 541 |
>>> isinstance(tab, pn.Column)
|
| 542 |
True
|
| 543 |
"""
|
| 544 |
-
simulation_title = pn.pane.Markdown("# Simulating Event Lists")
|
| 545 |
time_bins_input = pn.widgets.IntInput(
|
| 546 |
-
name="Number of Time Bins", value=10, step=1, start=1, end=
|
| 547 |
)
|
| 548 |
max_counts_input = pn.widgets.IntInput(
|
| 549 |
-
name="Max Counts per Bin", value=5, step=1, start=1, end=
|
| 550 |
)
|
| 551 |
dt_input = pn.widgets.FloatInput(
|
| 552 |
name="Delta Time (dt)", value=1.0, step=0.1, start=0.001, end=10000.0
|
| 553 |
)
|
| 554 |
-
method_selector = pn.widgets.Select(
|
| 555 |
-
name="Method", options=["Standard Method", "Inverse CDF Method"]
|
| 556 |
-
)
|
| 557 |
sim_name_input = pn.widgets.TextInput(
|
| 558 |
name="Simulated Event List Name", placeholder="e.g., my_sim_event_list"
|
| 559 |
)
|
| 560 |
simulate_button = pn.widgets.Button(
|
| 561 |
name="Simulate Event List", button_type="primary"
|
| 562 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 563 |
|
| 564 |
def on_simulate_button_click(event):
|
| 565 |
# Clear previous output and warnings
|
|
@@ -575,7 +573,6 @@ def create_simulate_event_list_tab(
|
|
| 575 |
max_counts_input,
|
| 576 |
dt_input,
|
| 577 |
sim_name_input,
|
| 578 |
-
method_selector,
|
| 579 |
output_box_container,
|
| 580 |
warning_box_container,
|
| 581 |
warning_handler,
|
|
@@ -588,7 +585,6 @@ def create_simulate_event_list_tab(
|
|
| 588 |
time_bins_input,
|
| 589 |
max_counts_input,
|
| 590 |
dt_input,
|
| 591 |
-
method_selector,
|
| 592 |
sim_name_input,
|
| 593 |
simulate_button,
|
| 594 |
)
|
|
@@ -622,13 +618,13 @@ def create_eventlist_operations_tab(
|
|
| 622 |
event_list_properties_box = pn.pane.Markdown(
|
| 623 |
"**Select an EventList to view its properties.**"
|
| 624 |
)
|
| 625 |
-
|
| 626 |
multi_light_curve_select = pn.widgets.MultiSelect(
|
| 627 |
name="Select Light Curve(s)",
|
| 628 |
options={name: i for i, (name, lc) in enumerate(loaded_light_curve)},
|
| 629 |
size=8,
|
| 630 |
)
|
| 631 |
-
|
| 632 |
light_curve_properties_box = pn.pane.Markdown(
|
| 633 |
"**Select a LightCurve to view its properties.**"
|
| 634 |
)
|
|
@@ -763,7 +759,7 @@ def create_eventlist_operations_tab(
|
|
| 763 |
)
|
| 764 |
|
| 765 |
event_list_properties_box.object = "\n".join(properties)
|
| 766 |
-
|
| 767 |
# Callback to update the lightcurve properties box
|
| 768 |
def update_light_curve_properties(event):
|
| 769 |
selected_indices = multi_light_curve_select.value
|
|
@@ -1329,23 +1325,26 @@ def create_eventlist_operations_tab(
|
|
| 1329 |
# Layout for the tab
|
| 1330 |
tab_content = pn.Column(
|
| 1331 |
pn.pane.Markdown("# EventList Operations"),
|
| 1332 |
-
pn.
|
| 1333 |
-
|
| 1334 |
-
|
| 1335 |
-
|
| 1336 |
-
|
| 1337 |
-
|
|
|
|
|
|
|
|
|
|
| 1338 |
),
|
| 1339 |
pn.Column(
|
| 1340 |
pn.FlexBox(
|
| 1341 |
-
|
| 1342 |
pn.Column(
|
| 1343 |
pn.pane.Markdown("## Apply Deadtime"),
|
| 1344 |
deadtime_input,
|
| 1345 |
deadtime_inplace_checkbox,
|
| 1346 |
apply_deadtime_button,
|
| 1347 |
width=400,
|
| 1348 |
-
height=300,
|
| 1349 |
),
|
| 1350 |
pn.Column(
|
| 1351 |
pn.pane.Markdown("## Convert PI to Energy"),
|
|
@@ -1355,13 +1354,9 @@ def create_eventlist_operations_tab(
|
|
| 1355 |
width=400,
|
| 1356 |
height=300,
|
| 1357 |
),
|
| 1358 |
-
|
| 1359 |
-
|
| 1360 |
-
|
| 1361 |
-
justify_content="flex-start",
|
| 1362 |
-
gap="50px",
|
| 1363 |
-
),
|
| 1364 |
-
pn.FlexBox(
|
| 1365 |
pn.Column(
|
| 1366 |
pn.pane.Markdown("## Filter by Energy Range"),
|
| 1367 |
energy_range_input,
|
|
@@ -1388,13 +1383,8 @@ def create_eventlist_operations_tab(
|
|
| 1388 |
width=400,
|
| 1389 |
height=300,
|
| 1390 |
),
|
| 1391 |
-
|
| 1392 |
-
|
| 1393 |
-
align_items="flex-start",
|
| 1394 |
-
justify_content="flex-start",
|
| 1395 |
-
gap="50px",
|
| 1396 |
-
),
|
| 1397 |
-
pn.FlexBox(
|
| 1398 |
pn.Column(
|
| 1399 |
pn.pane.Markdown("## Compute Intensity Evolution"),
|
| 1400 |
intensity_energy_range_input,
|
|
@@ -1418,17 +1408,11 @@ def create_eventlist_operations_tab(
|
|
| 1418 |
width=400,
|
| 1419 |
height=300,
|
| 1420 |
),
|
| 1421 |
-
|
| 1422 |
-
flex_wrap="nowrap",
|
| 1423 |
-
align_items="flex-start",
|
| 1424 |
-
justify_content="flex-start",
|
| 1425 |
-
gap="50px",
|
| 1426 |
-
),
|
| 1427 |
flex_direction="row",
|
| 1428 |
flex_wrap="wrap",
|
| 1429 |
align_items="center",
|
| 1430 |
justify_content="center",
|
| 1431 |
-
|
| 1432 |
)
|
| 1433 |
),
|
| 1434 |
pn.pane.Markdown("<br/>"),
|
|
|
|
| 292 |
max_counts_input,
|
| 293 |
dt_input,
|
| 294 |
name_input,
|
|
|
|
| 295 |
output_box_container,
|
| 296 |
warning_box_container,
|
| 297 |
warning_handler,
|
|
|
|
| 352 |
|
| 353 |
# Simulate the light curve
|
| 354 |
times = np.arange(time_bins)
|
| 355 |
+
counts = np.random.randint(0, max_counts, size=time_bins)
|
| 356 |
lc = Lightcurve(times, counts, dt=dt, skip_checks=True)
|
| 357 |
|
| 358 |
+
event_list = EventList.from_lc(lc)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
|
| 360 |
name = name_input.value
|
| 361 |
loaded_event_data.append((name, event_list))
|
|
|
|
| 536 |
>>> isinstance(tab, pn.Column)
|
| 537 |
True
|
| 538 |
"""
|
| 539 |
+
simulation_title = pn.pane.Markdown("# Simulating Random Event Lists")
|
| 540 |
time_bins_input = pn.widgets.IntInput(
|
| 541 |
+
name="Number of Time Bins", value=10, step=1, start=1, end=1000000
|
| 542 |
)
|
| 543 |
max_counts_input = pn.widgets.IntInput(
|
| 544 |
+
name="Max Possible Counts per Bin", value=5, step=1, start=1, end=100000
|
| 545 |
)
|
| 546 |
dt_input = pn.widgets.FloatInput(
|
| 547 |
name="Delta Time (dt)", value=1.0, step=0.1, start=0.001, end=10000.0
|
| 548 |
)
|
|
|
|
|
|
|
|
|
|
| 549 |
sim_name_input = pn.widgets.TextInput(
|
| 550 |
name="Simulated Event List Name", placeholder="e.g., my_sim_event_list"
|
| 551 |
)
|
| 552 |
simulate_button = pn.widgets.Button(
|
| 553 |
name="Simulate Event List", button_type="primary"
|
| 554 |
)
|
| 555 |
+
simulate_button_tooltip = pn.widgets.TooltipIcon(
|
| 556 |
+
value=Tooltip(
|
| 557 |
+
content="""Simulate a random light curve and then use it to get the EventList from the specified parameters.""",
|
| 558 |
+
position="bottom",
|
| 559 |
+
)
|
| 560 |
+
)
|
| 561 |
|
| 562 |
def on_simulate_button_click(event):
|
| 563 |
# Clear previous output and warnings
|
|
|
|
| 573 |
max_counts_input,
|
| 574 |
dt_input,
|
| 575 |
sim_name_input,
|
|
|
|
| 576 |
output_box_container,
|
| 577 |
warning_box_container,
|
| 578 |
warning_handler,
|
|
|
|
| 585 |
time_bins_input,
|
| 586 |
max_counts_input,
|
| 587 |
dt_input,
|
|
|
|
| 588 |
sim_name_input,
|
| 589 |
simulate_button,
|
| 590 |
)
|
|
|
|
| 618 |
event_list_properties_box = pn.pane.Markdown(
|
| 619 |
"**Select an EventList to view its properties.**"
|
| 620 |
)
|
| 621 |
+
|
| 622 |
multi_light_curve_select = pn.widgets.MultiSelect(
|
| 623 |
name="Select Light Curve(s)",
|
| 624 |
options={name: i for i, (name, lc) in enumerate(loaded_light_curve)},
|
| 625 |
size=8,
|
| 626 |
)
|
| 627 |
+
|
| 628 |
light_curve_properties_box = pn.pane.Markdown(
|
| 629 |
"**Select a LightCurve to view its properties.**"
|
| 630 |
)
|
|
|
|
| 759 |
)
|
| 760 |
|
| 761 |
event_list_properties_box.object = "\n".join(properties)
|
| 762 |
+
|
| 763 |
# Callback to update the lightcurve properties box
|
| 764 |
def update_light_curve_properties(event):
|
| 765 |
selected_indices = multi_light_curve_select.value
|
|
|
|
| 1325 |
# Layout for the tab
|
| 1326 |
tab_content = pn.Column(
|
| 1327 |
pn.pane.Markdown("# EventList Operations"),
|
| 1328 |
+
pn.Row(
|
| 1329 |
+
pn.Column(
|
| 1330 |
+
multi_event_list_select,
|
| 1331 |
+
event_list_properties_box,
|
| 1332 |
+
),
|
| 1333 |
+
pn.Column(
|
| 1334 |
+
multi_light_curve_select,
|
| 1335 |
+
light_curve_properties_box,
|
| 1336 |
+
),
|
| 1337 |
),
|
| 1338 |
pn.Column(
|
| 1339 |
pn.FlexBox(
|
| 1340 |
+
|
| 1341 |
pn.Column(
|
| 1342 |
pn.pane.Markdown("## Apply Deadtime"),
|
| 1343 |
deadtime_input,
|
| 1344 |
deadtime_inplace_checkbox,
|
| 1345 |
apply_deadtime_button,
|
| 1346 |
width=400,
|
| 1347 |
+
height=300,
|
| 1348 |
),
|
| 1349 |
pn.Column(
|
| 1350 |
pn.pane.Markdown("## Convert PI to Energy"),
|
|
|
|
| 1354 |
width=400,
|
| 1355 |
height=300,
|
| 1356 |
),
|
| 1357 |
+
|
| 1358 |
+
|
| 1359 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1360 |
pn.Column(
|
| 1361 |
pn.pane.Markdown("## Filter by Energy Range"),
|
| 1362 |
energy_range_input,
|
|
|
|
| 1383 |
width=400,
|
| 1384 |
height=300,
|
| 1385 |
),
|
| 1386 |
+
|
| 1387 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1388 |
pn.Column(
|
| 1389 |
pn.pane.Markdown("## Compute Intensity Evolution"),
|
| 1390 |
intensity_energy_range_input,
|
|
|
|
| 1408 |
width=400,
|
| 1409 |
height=300,
|
| 1410 |
),
|
| 1411 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1412 |
flex_direction="row",
|
| 1413 |
flex_wrap="wrap",
|
| 1414 |
align_items="center",
|
| 1415 |
justify_content="center",
|
|
|
|
| 1416 |
)
|
| 1417 |
),
|
| 1418 |
pn.pane.Markdown("<br/>"),
|