From ab3a4df763da19d205482eacab45d013299f5f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Thu, 18 Mar 2021 19:15:30 +0100 Subject: [PATCH 1/5] Fix parallelize for n_jobs=1 --- aict_tools/parallel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aict_tools/parallel.py b/aict_tools/parallel.py index 9eae5df2..2867f911 100644 --- a/aict_tools/parallel.py +++ b/aict_tools/parallel.py @@ -11,7 +11,7 @@ def parallelize_array_computation(func, *arrays, n_jobs=-1, **kwargs): n_jobs = cpu_count() if n_jobs == 1: - return func(*arrays) + return [func(*arrays)] n_elements = list(set(len(a) for a in arrays)) if len(n_elements) > 1: From a8b23e96c4565b2aba3ae55e64e2abda09b7e115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Thu, 18 Mar 2021 19:18:37 +0100 Subject: [PATCH 2/5] Use ErfaAstromInterpolator --- aict_tools/scripts/fact_to_dl3.py | 15 ++++++++++++--- setup.py | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/aict_tools/scripts/fact_to_dl3.py b/aict_tools/scripts/fact_to_dl3.py index dcab0387..04adbbfd 100644 --- a/aict_tools/scripts/fact_to_dl3.py +++ b/aict_tools/scripts/fact_to_dl3.py @@ -8,6 +8,7 @@ from astropy.time import Time from astropy.coordinates import AltAz, SkyCoord +from astropy.coordinates.erfa_astrom import erfa_astrom, ErfaAstromInterpolator import astropy.units as u from fact.io import read_h5py, to_h5py @@ -31,6 +32,10 @@ from ..preprocessing import calc_true_disp from ..logging import setup_logging +# use interpolation for all coordinate transforms +# 100x speed increase with no precision lost (~uas) +erfa_astrom.set(ErfaAstromInterpolator(5 * u.min)) + dl3_columns = [ 'run_id', @@ -92,10 +97,14 @@ def to_altaz(obstime, source): def concat_results_altaz(results): - obstime = np.concatenate([s.obstime for s in results]) + jd1 = np.concatenate([s.obstime.jd1 for s in results]) + jd2 = np.concatenate([s.obstime.jd2 for s in results]) + obstime = Time(jd1, jd2, format='jd', copy=False) + + alt = u.Quantity(np.concatenate([s.alt.deg for s in results]), u.deg, copy=False) + az= u.Quantity(np.concatenate([s.az.deg for s in results]), u.deg, copy=False) return SkyCoord( - alt=np.concatenate([s.alt.deg for s in results]) * u.deg, - az=np.concatenate([s.az.deg for s in results]) * u.deg, + alt=alt, az=az, frame=AltAz(location=LOCATION, obstime=obstime) ) diff --git a/setup.py b/setup.py index 2368c307..2a6fa49d 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ setup_requires=['pytest-runner'], tests_require=['pytest'], install_requires=[ - 'astropy', # in anaconda + 'astropy~=4.2', # in anaconda 'click', # in anaconda 'h5py', # in anaconda 'joblib', # in anaconda From 910ea542b59ad50765366f99c98eae43c15a88dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Thu, 18 Mar 2021 19:19:05 +0100 Subject: [PATCH 3/5] Add az_prediction and zd_prediction columns --- aict_tools/scripts/fact_to_dl3.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aict_tools/scripts/fact_to_dl3.py b/aict_tools/scripts/fact_to_dl3.py index 04adbbfd..6d6b8f88 100644 --- a/aict_tools/scripts/fact_to_dl3.py +++ b/aict_tools/scripts/fact_to_dl3.py @@ -51,6 +51,8 @@ 'theta_deg_off_5', 'pointing_position_az', 'pointing_position_zd', + 'az_prediction', + 'zd_prediction', ] dl3_columns_sim_read = [ 'corsika_run_header_run_number', @@ -118,6 +120,12 @@ def calc_source_features_common( pointing_position_az, ): result = {} + + k_zd, k_az = 'zd_prediction', 'az_prediction' + result[k_zd], result[k_az] = camera_to_horizontal( + prediction_x, prediction_y, + pointing_position_zd, pointing_position_az, + ) result['theta_deg'] = calc_theta_camera( prediction_x, prediction_y, From 01038f06d7055c291ebf4f0af5155f70336aa32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Thu, 18 Mar 2021 19:20:36 +0100 Subject: [PATCH 4/5] Bump version --- aict_tools/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aict_tools/__init__.py b/aict_tools/__init__.py index e11448a9..826d20e8 100644 --- a/aict_tools/__init__.py +++ b/aict_tools/__init__.py @@ -1 +1 @@ -__version__ = '0.25.1' +__version__ = '0.26.0' From 52daf3ab73f21ebdbceda2121276bd03b0a6fc3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20N=C3=B6the?= Date: Fri, 19 Mar 2021 10:30:04 +0100 Subject: [PATCH 5/5] Require python >= 3.7 --- .travis.yml | 3 +-- setup.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 112753d8..3e093176 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ env: matrix: include: - - python: '3.6' - python: '3.7' - python: '3.8' @@ -33,7 +32,7 @@ deploy: on: branch: master tags: true - condition: $TRAVIS_PYTHON_VERSION = '3.7' + condition: $TRAVIS_PYTHON_VERSION = '3.8' addons: diff --git a/setup.py b/setup.py index 2a6fa49d..4a1975e0 100644 --- a/setup.py +++ b/setup.py @@ -31,6 +31,7 @@ author_email='kai.bruegge@tu-dortmund.de', license='MIT', packages=find_packages(), + python_requires='>=3.7', setup_requires=['pytest-runner'], tests_require=['pytest'], install_requires=[ @@ -78,7 +79,6 @@ 'Natural Language :: English', 'Operating System :: OS Independent', 'Programming Language :: Python', - 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3 :: Only',