@@ -607,8 +607,9 @@ def compute_detectability_basic_sig_checks(
607607 high_sig_check = 0.95 ,
608608 min_amp_sig_check = 3.0 ,
609609 amp_sig_check = 20.0 ,
610- period_check_bound = 0.01 ,
611- amp_check_bound = 0.01 ,
610+ min_delta_mag = 0.01 ,
611+ period_check_bound = 0.02 ,
612+ amp_check_bound = 0.1 ,
612613 out_bin_detect_table_root = './bin_detect' ,
613614 print_diagnostics = False ,
614615 ):
@@ -636,10 +637,13 @@ def compute_detectability_basic_sig_checks(
636637 amp_sig_check : float, default: 20.0
637638 Signals between low_sig_check and high_sig_check have to pass this
638639 bound in amp significance.
639- period_check_bound : float, default: 0.01
640+ min_delta_mag : float, default: 0.01
641+ All signals to be considered have to pass this bound in delta mag
642+ for the mock binary.
643+ period_check_bound : float, default: 0.02
640644 Within what percent of the real binary period to consider a
641645 detection to be a real detection.
642- amp_check_bound : float, default: 0.01
646+ amp_check_bound : float, default: 0.1
643647 Within what percent in magnitudes of real binary light curve
644648 amplitude to consider a period detection to be a real detection.
645649 out_bin_detect_table_root : str, default: './bin_detect'
@@ -732,7 +736,14 @@ def compute_detectability_basic_sig_checks(
732736 print ('---' )
733737 print (f'SBV ID: { sbv } ' )
734738 print (f'True Binary Period: { mock_true_period :.3f} d' )
735-
739+
740+ # Check for mock binary amplitude being too smol
741+ if mock_true_amp < min_delta_mag :
742+ if print_diagnostics :
743+ print ('Mock binary mag amplitude is too small' )
744+
745+ continue
746+
736747 # Check for long period getting aliased
737748 longPer_filt = np .where (
738749 sbv_LS_results ['LS_periods' ] >= self .longPer_boundary )
@@ -846,7 +857,7 @@ def compute_detectability_basic_sig_checks(
846857 print (f'cos amp / cos amp sig = { peak_amp_sig :.3f} ' )
847858 print (f'Peak BS sig = { (peak_sig * 100 ):.3f} %' )
848859
849- if peak_amp < min_amp_sig_check :
860+ if peak_amp_sig < min_amp_sig_check :
850861 if print_diagnostics :
851862 print ('Amplitude < min amp of {min_amp_sig_check}' )
852863
@@ -1440,6 +1451,9 @@ def compute_detectability(
14401451 self , stars_list ,
14411452 num_mock_bins = 100 ,
14421453 min_amp_sig_check = 4.0 ,
1454+ min_delta_mag = 0.01 ,
1455+ period_check_bound = 0.02 ,
1456+ amp_check_bound = 0.1 ,
14431457 sig_hist_table = '../bin_detectability/false_true_hist.h5' ,
14441458 detection_sig_levels = [
14451459 '4 sig' , '5 sig' , 'gt 5 sig' ,
@@ -1461,6 +1475,15 @@ def compute_detectability(
14611475 min_amp_sig_check : float, default: 4.0
14621476 All signals to be considered have to pass this bound in amp
14631477 significance.
1478+ min_delta_mag : float, default: 0.01
1479+ All signals to be considered have to pass this bound in delta mag
1480+ for the mock binary.
1481+ period_check_bound : float, default: 0.02
1482+ Within what percent of the real binary period to consider a
1483+ detection to be a real detection.
1484+ amp_check_bound : float, default: 0.1
1485+ Within what percent in magnitudes of real binary light curve
1486+ amplitude to consider a period detection to be a real detection.
14641487 sig_hist_table : str, default='../bin_detectability/false_true_hist.h5'
14651488 Location of hdf5 astropy table with the significance regions for
14661489 false and true detections
@@ -1523,6 +1546,10 @@ def compute_detectability(
15231546 passing_sbvs_LS_sig_all = np .array ([])
15241547 passing_sbvs_sin_amp_all = np .array ([])
15251548
1549+ # Construct low and high period check bounds
1550+ lo_per_check = 1.0 - period_check_bound
1551+ hi_per_check = 1.0 + period_check_bound
1552+
15261553 # Compute detectability for every star in specified sample
15271554 for (star_index , star ) in tqdm (enumerate (stars_list ), total = len (stars_list )):
15281555 # Read star model, LS, and amp sig tables
@@ -1566,12 +1593,23 @@ def compute_detectability(
15661593 mock_bin_lc_row = self .model_lc_params_table .loc [mock_bin_id ]
15671594
15681595 mock_true_period = mock_bin_row ['binary_period' ]
1569-
1596+ mock_true_amp = mock_bin_lc_row ['delta_mag_kp' ]
1597+
1598+ lo_amp_check = mock_true_amp - amp_check_bound
1599+ hi_amp_check = mock_true_amp + amp_check_bound
1600+
15701601 if print_diagnostics :
15711602 print ('---' )
15721603 print (f'SBV ID: { sbv } ' )
15731604 print (f'True Binary Period: { mock_true_period :.3f} d' )
1574-
1605+
1606+ # Check for mock binary amplitude being too smol
1607+ if mock_true_amp < min_delta_mag :
1608+ if print_diagnostics :
1609+ print ('Mock binary mag amplitude is too small' )
1610+
1611+ continue
1612+
15751613 # Check for long period getting aliased
15761614 longPer_filt = np .where (
15771615 sbv_LS_results ['LS_periods' ] >= self .longPer_boundary )
@@ -1676,7 +1714,16 @@ def compute_detectability(
16761714 peak_amp = (star_amp_sig_table .loc [sbv ])['cos_amps' ]
16771715 peak_amp_sig = (star_amp_sig_table .loc [sbv ])['cos_amp_sigs' ]
16781716
1679- if peak_amp < min_amp_sig_check :
1717+ amp_match_check = (
1718+ (lo_amp_check ) <= (peak_amp * 2. ) and
1719+ (hi_amp_check ) >= (peak_amp * 2. )
1720+ )
1721+
1722+ if print_diagnostics :
1723+ print (f'cos amp / cos amp sig = { peak_amp_sig :.3f} ' )
1724+ print (f'Peak BS sig = { (peak_sig * 100 ):.3f} %' )
1725+
1726+ if peak_amp_sig < min_amp_sig_check :
16801727 if print_diagnostics :
16811728 print ('Amplitude < min amp of {min_amp_sig_check}' )
16821729
@@ -1828,4 +1875,4 @@ def compute_detectability(
18281875 format = 'hdf5' , path = 'data' , overwrite = True )
18291876
18301877 # Return final table
1831- return bin_detect_table
1878+ return bin_detect_table
0 commit comments