@@ -317,6 +317,7 @@ def get_starcats_as_table(
317
317
scenario = None ,
318
318
cmds = None ,
319
319
starcat_date = None ,
320
+ event_filter = None ,
320
321
):
321
322
"""Get a single table of star catalog entries corresponding to input parameters.
322
323
@@ -360,6 +361,10 @@ def get_starcats_as_table(
360
361
Use this command table instead of querying the archive.
361
362
starcat_date : CxoTime-like, None
362
363
Date of the observation's star catalog
364
+ event_filter : callable, list of callable, None
365
+ Callable function or list of callable functions that takes an Event Table as
366
+ input and returns a boolean mask with same length as Table. If None, no
367
+ filtering is done.
363
368
364
369
Returns
365
370
-------
@@ -374,6 +379,7 @@ def get_starcats_as_table(
374
379
cmds = cmds ,
375
380
starcat_date = starcat_date ,
376
381
as_dict = True ,
382
+ event_filter = event_filter ,
377
383
)
378
384
out = defaultdict (list )
379
385
for starcat in starcats :
@@ -404,6 +410,7 @@ def get_starcats(
404
410
as_dict = False ,
405
411
starcat_date = None ,
406
412
show_progress = False ,
413
+ event_filter = None ,
407
414
):
408
415
"""Get a list of star catalogs corresponding to input parameters.
409
416
@@ -478,6 +485,10 @@ def get_starcats(
478
485
Date of the observation's star catalog
479
486
show_progress : bool
480
487
Show progress bar for long queries (default=False)
488
+ event_filter : callable, list of callable, None
489
+ Callable function or list of callable functions that takes an Event Table as
490
+ input and returns a boolean mask with same length as Table. If None, no
491
+ filtering is done.
481
492
482
493
Returns
483
494
-------
@@ -501,6 +512,7 @@ def get_starcats(
501
512
scenario = scenario ,
502
513
cmds = cmds ,
503
514
starcat_date = starcat_date ,
515
+ event_filter = event_filter ,
504
516
)
505
517
starcats = []
506
518
rev_pars_dict = REV_PARS_DICT if cmds is None else cmds .rev_pars_dict ()
@@ -571,7 +583,14 @@ def get_starcats(
571
583
572
584
573
585
def get_observations (
574
- start = None , stop = None , * , obsid = None , scenario = None , cmds = None , starcat_date = None
586
+ start = None ,
587
+ stop = None ,
588
+ * ,
589
+ obsid = None ,
590
+ scenario = None ,
591
+ cmds = None ,
592
+ starcat_date = None ,
593
+ event_filter = None ,
575
594
):
576
595
"""Get observations corresponding to input parameters.
577
596
@@ -604,8 +623,9 @@ def get_observations(
604
623
605
624
>>> obs_all = get_observations() # All observations in commands archive
606
625
607
- # Might be convenient to handle this as a Table >>> from astropy.table
608
- import Table >>> obs_all = Table(obs_all)
626
+ # Might be convenient to handle this as a Table
627
+ >>> from astropy.table import Table
628
+ >>> obs_all = Table(obs_all)
609
629
610
630
>>> from kadi.commands import get_observations
611
631
>>> get_observations(starcat_date='2022:001:17:00:58.521')
@@ -635,6 +655,10 @@ def get_observations(
635
655
Use this command table instead of querying the archive
636
656
starcat_date : CxoTime-like, None
637
657
Date of the observation's star catalog
658
+ event_filter : callable, list of callable, None
659
+ Callable function or list of callable functions that takes an Event Table as
660
+ input and returns a boolean mask with same length as Table. If None, no
661
+ filtering is done.
638
662
639
663
Returns
640
664
-------
@@ -651,7 +675,7 @@ def get_observations(
651
675
652
676
if cmds is None :
653
677
if scenario not in OBSERVATIONS :
654
- cmds = get_cmds (scenario = scenario )
678
+ cmds = get_cmds (scenario = scenario , event_filter = event_filter )
655
679
cmds_obs = cmds [cmds ["tlmsid" ] == "OBS" ]
656
680
obsids = []
657
681
for cmd in cmds_obs :
0 commit comments