tkmatrix 0.6.4__tar.gz → 0.6.6__tar.gz
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.
- {tkmatrix-0.6.4/tkmatrix.egg-info → tkmatrix-0.6.6}/PKG-INFO +1 -1
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/setup.py +2 -2
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/tests/test_tkmatrix.py +2 -2
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/tkmatrix_class.py +51 -16
- {tkmatrix-0.6.4 → tkmatrix-0.6.6/tkmatrix.egg-info}/PKG-INFO +1 -1
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix.egg-info/requires.txt +1 -1
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/LICENSE +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/MANIFEST.in +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/README.md +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/setup.cfg +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/__init__.py +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/__main__.py +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/custom_algorithms/__init__.py +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/inject_model.py +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/inject_rv_model.py +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/properties.yaml +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/rv.py +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix/tests/__init__.py +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix.egg-info/SOURCES.txt +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix.egg-info/dependency_links.txt +0 -0
- {tkmatrix-0.6.4 → tkmatrix-0.6.6}/tkmatrix.egg-info/top_level.txt +0 -0
|
@@ -2,7 +2,7 @@ import setuptools
|
|
|
2
2
|
|
|
3
3
|
with open("README.md", "r") as fh:
|
|
4
4
|
long_description = fh.read()
|
|
5
|
-
version = "0.6.
|
|
5
|
+
version = "0.6.6"
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="tkmatrix",
|
|
8
8
|
version=version,
|
|
@@ -26,7 +26,7 @@ setuptools.setup(
|
|
|
26
26
|
"corner==2.1.0",
|
|
27
27
|
"cython==0.29.21",
|
|
28
28
|
"ellc==1.8.5",
|
|
29
|
-
"lcbuilder==0.12.
|
|
29
|
+
"lcbuilder==0.12.8",
|
|
30
30
|
"matplotlib==3.5.2",
|
|
31
31
|
"mock==4.0.3",
|
|
32
32
|
'numba>=0.53.0rc1',
|
|
@@ -35,7 +35,7 @@ class TestsMatrix(unittest.TestCase):
|
|
|
35
35
|
self.assertEquals(".", matrix.dir)
|
|
36
36
|
matrix.recovery(inject_dir, 5, detrend_ws=0, oversampling=0.1)
|
|
37
37
|
matrix.plot_results(target, inject_dir)
|
|
38
|
-
self.assertEquals(
|
|
38
|
+
self.assertEquals(9, len(os.listdir(inject_dir)))
|
|
39
39
|
finally:
|
|
40
40
|
if inject_dir is not None:
|
|
41
41
|
shutil.rmtree(inject_dir, ignore_errors=True)
|
|
@@ -48,7 +48,7 @@ class TestsMatrix(unittest.TestCase):
|
|
|
48
48
|
inject_dir, period_grid, radius_grid = matrix.inject(1, 5, 5, 1, 3, 3, 1)
|
|
49
49
|
matrix.recovery(inject_dir, 5, detrend_ws=0, oversampling=0.1)
|
|
50
50
|
matrix.plot_results(target, inject_dir)
|
|
51
|
-
self.assertEquals(
|
|
51
|
+
self.assertEquals(10, len(os.listdir(inject_dir)))
|
|
52
52
|
finally:
|
|
53
53
|
if inject_dir is not None:
|
|
54
54
|
shutil.rmtree(inject_dir, ignore_errors=True)
|
|
@@ -410,6 +410,8 @@ class MATRIX:
|
|
|
410
410
|
transit_template = 'box'
|
|
411
411
|
reports_df = pd.DataFrame(columns=['period', 'radius', 'epoch', 'duration_found', 'period_found', 'epoch_found',
|
|
412
412
|
'found', 'snr', 'sde', 'run'])
|
|
413
|
+
run_reports_df = pd.DataFrame(columns=['period', 'radius', 'epoch', 'duration_found', 'period_found', 'epoch_found',
|
|
414
|
+
'found', 'snr', 'sde', 'run'])
|
|
413
415
|
for file in sorted(os.listdir(inject_dir)):
|
|
414
416
|
file_name_matches = re.search("P([0-9]+\\.*[0-9]*)+_R([0-9]+\\.*[0-9]*)_([0-9]+\\.*[0-9]*)\\.csv", file)
|
|
415
417
|
if file_name_matches is not None:
|
|
@@ -420,32 +422,43 @@ class MATRIX:
|
|
|
420
422
|
df = pd.read_csv(inject_dir + file, float_precision='round_trip', sep=',',
|
|
421
423
|
usecols=['#time', 'flux', 'flux_err'])
|
|
422
424
|
if len(df) == 0:
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
425
|
+
founds = [True]
|
|
426
|
+
snrs = [20]
|
|
427
|
+
sdes = [self.SDE_ROCHE]
|
|
428
|
+
runs = [1]
|
|
429
|
+
durations_found = [20]
|
|
430
|
+
epochs_found = [0]
|
|
431
|
+
periods_found = [0]
|
|
430
432
|
else:
|
|
431
433
|
self.retrieve_object_data_for_recovery(inject_dir + "/", inject_dir + file)
|
|
432
|
-
|
|
433
|
-
self.__search(self.lc_build.lc.time.value, self.lc_build.lc.flux.value, self.radius,
|
|
434
|
-
self.radiusmax, self.mass, self.massmin,
|
|
434
|
+
founds, snrs, sdes, runs, durations_found, periods_found, epochs_found = \
|
|
435
|
+
self.__search(self.lc_build.lc.time.value, self.lc_build.lc.flux.value, self.radius,
|
|
436
|
+
self.radiusmin, self.radiusmax, self.mass, self.massmin,
|
|
435
437
|
self.massmax, self.ab, epoch, period, self.MIN_SEARCH_PERIOD,
|
|
436
438
|
max_period_search, snr_threshold,
|
|
437
439
|
transit_template, detrend_method, detrend_ws,
|
|
438
440
|
self.lc_build.transits_min_count, run_limit, custom_search_algorithm,
|
|
439
441
|
oversampling, signal_selection_mode)
|
|
440
|
-
new_report = {"period": period, "radius": r_planet, "epoch": epoch,
|
|
441
|
-
"
|
|
442
|
-
"
|
|
442
|
+
new_report = {"period": period, "radius": r_planet, "epoch": epoch,
|
|
443
|
+
"found": founds[-1], "snr": ','.join([str(i) for i in snrs]),
|
|
444
|
+
"sde": ','.join([str(i) for i in sdes]), "run": ','.join([str(i) for i in runs]),
|
|
445
|
+
"duration_found": ','.join([str(i) for i in durations_found]),
|
|
446
|
+
"period_found": ','.join([str(i) for i in periods_found]),
|
|
447
|
+
"epoch_found": ','.join([str(i) for i in epochs_found])}
|
|
443
448
|
reports_df = reports_df.append(new_report, ignore_index=True)
|
|
449
|
+
for i in np.arange(0, len(founds)):
|
|
450
|
+
run_reports_df = run_reports_df.append(
|
|
451
|
+
{"period": period, "radius": r_planet, "epoch": epoch, "found": founds[i], "snr": snrs[i],
|
|
452
|
+
"sde": sdes[i], "run": runs[i], "duration_found": durations_found[i],
|
|
453
|
+
"period_found": periods_found[i], "epoch_found": epochs_found[i]}, ignore_index=True)
|
|
444
454
|
print("P=" + str(period) + ", R=" + str(r_planet) + ", T0=" + str(epoch) + ", FOUND WAS " + str(
|
|
445
|
-
|
|
446
|
-
" WITH
|
|
455
|
+
founds[-1]) +
|
|
456
|
+
" WITH SNRs " + str(snrs) + " AND SDEs " + str(sdes))
|
|
447
457
|
reports_df = reports_df.sort_values(['period', 'radius', 'epoch'], ascending=[True, True, True])
|
|
458
|
+
run_reports_df = run_reports_df.sort_values(['period', 'radius', 'epoch', 'run'],
|
|
459
|
+
ascending=[True, True, True, True])
|
|
448
460
|
reports_df.to_csv(inject_dir + "a_tls_report.csv", index=False)
|
|
461
|
+
run_reports_df.to_csv(inject_dir + "a_tls_report_per_run.csv", index=False)
|
|
449
462
|
except Exception as e:
|
|
450
463
|
traceback.print_exc()
|
|
451
464
|
print("File not valid: " + file)
|
|
@@ -646,6 +659,13 @@ class MATRIX:
|
|
|
646
659
|
elif detrend_method == self.DETREND_GP:
|
|
647
660
|
flux = wotan.flatten(time, flux, method=self.DETREND_GP, kernel='matern', kernel_size=ws,
|
|
648
661
|
return_trend=False, break_tolerance=0.5)
|
|
662
|
+
found_signals = []
|
|
663
|
+
snrs = []
|
|
664
|
+
sdes = []
|
|
665
|
+
runs = []
|
|
666
|
+
durations = []
|
|
667
|
+
periods = []
|
|
668
|
+
t0s = []
|
|
649
669
|
while snr >= min_snr and not found_signal and (run_limit > 0 and run < run_limit):
|
|
650
670
|
model = transitleastsquares(time, flux)
|
|
651
671
|
# R_starx = rstar / u.R_sun
|
|
@@ -671,6 +691,7 @@ class MATRIX:
|
|
|
671
691
|
flux = flux[~intransit_result]
|
|
672
692
|
time, flux = cleaned_array(time, flux)
|
|
673
693
|
if results.transit_times is not None and len(results.transit_times) > 0:
|
|
694
|
+
print(f"Selecting signal with mode {signal_selection_mode}")
|
|
674
695
|
if signal_selection_mode == 'period-epoch':
|
|
675
696
|
found_signal = HarmonicSelector.is_harmonic(results.transit_times[0], epoch, results.period, period)
|
|
676
697
|
else:
|
|
@@ -679,9 +700,23 @@ class MATRIX:
|
|
|
679
700
|
# plt.xlim([0.4, 0.6])
|
|
680
701
|
# plt.show()
|
|
681
702
|
if found_signal:
|
|
703
|
+
found_signals = found_signals + [found_signal]
|
|
704
|
+
snrs = snrs + [results.snr]
|
|
705
|
+
sdes = sdes + [results.SDE]
|
|
706
|
+
runs = runs + [run]
|
|
707
|
+
durations = durations + [results.duration]
|
|
708
|
+
periods = periods + [results.period]
|
|
709
|
+
t0s = t0s + [results.T0]
|
|
682
710
|
break
|
|
711
|
+
found_signals = found_signals + [found_signal]
|
|
712
|
+
snrs = snrs + [results.snr]
|
|
713
|
+
sdes = sdes + [results.SDE]
|
|
714
|
+
runs = runs + [run]
|
|
715
|
+
durations = durations + [results.duration]
|
|
716
|
+
periods = periods + [results.period]
|
|
717
|
+
t0s = t0s + [results.T0]
|
|
683
718
|
run = run + 1
|
|
684
|
-
return
|
|
719
|
+
return found_signals, snrs, sdes, runs, durations, periods, t0s
|
|
685
720
|
|
|
686
721
|
@staticmethod
|
|
687
722
|
def num_of_zeros(n):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|