Skip to content

Commit d8727dd

Browse files
authored
Merge pull request #148 from fact-project/improve_fact_dl3
Improve fact dl3
2 parents 5161efe + 52daf3a commit d8727dd

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ env:
1010

1111
matrix:
1212
include:
13-
- python: '3.6'
1413
- python: '3.7'
1514
- python: '3.8'
1615

@@ -33,7 +32,7 @@ deploy:
3332
on:
3433
branch: master
3534
tags: true
36-
condition: $TRAVIS_PYTHON_VERSION = '3.7'
35+
condition: $TRAVIS_PYTHON_VERSION = '3.8'
3736

3837

3938
addons:

aict_tools/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.25.1'
1+
__version__ = '0.26.0'

aict_tools/parallel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def parallelize_array_computation(func, *arrays, n_jobs=-1, **kwargs):
1111
n_jobs = cpu_count()
1212

1313
if n_jobs == 1:
14-
return func(*arrays)
14+
return [func(*arrays)]
1515

1616
n_elements = list(set(len(a) for a in arrays))
1717
if len(n_elements) > 1:

aict_tools/scripts/fact_to_dl3.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from astropy.time import Time
1010
from astropy.coordinates import AltAz, SkyCoord
11+
from astropy.coordinates.erfa_astrom import erfa_astrom, ErfaAstromInterpolator
1112
import astropy.units as u
1213

1314
from fact.io import read_h5py, to_h5py
@@ -31,6 +32,10 @@
3132
from ..preprocessing import calc_true_disp
3233
from ..logging import setup_logging
3334

35+
# use interpolation for all coordinate transforms
36+
# 100x speed increase with no precision lost (~uas)
37+
erfa_astrom.set(ErfaAstromInterpolator(5 * u.min))
38+
3439

3540
dl3_columns = [
3641
'run_id',
@@ -46,6 +51,8 @@
4651
'theta_deg_off_5',
4752
'pointing_position_az',
4853
'pointing_position_zd',
54+
'az_prediction',
55+
'zd_prediction',
4956
]
5057
dl3_columns_sim_read = [
5158
'corsika_run_header_run_number',
@@ -92,10 +99,14 @@ def to_altaz(obstime, source):
9299

93100

94101
def concat_results_altaz(results):
95-
obstime = np.concatenate([s.obstime for s in results])
102+
jd1 = np.concatenate([s.obstime.jd1 for s in results])
103+
jd2 = np.concatenate([s.obstime.jd2 for s in results])
104+
obstime = Time(jd1, jd2, format='jd', copy=False)
105+
106+
alt = u.Quantity(np.concatenate([s.alt.deg for s in results]), u.deg, copy=False)
107+
az= u.Quantity(np.concatenate([s.az.deg for s in results]), u.deg, copy=False)
96108
return SkyCoord(
97-
alt=np.concatenate([s.alt.deg for s in results]) * u.deg,
98-
az=np.concatenate([s.az.deg for s in results]) * u.deg,
109+
alt=alt, az=az,
99110
frame=AltAz(location=LOCATION, obstime=obstime)
100111
)
101112

@@ -109,6 +120,12 @@ def calc_source_features_common(
109120
pointing_position_az,
110121
):
111122
result = {}
123+
124+
k_zd, k_az = 'zd_prediction', 'az_prediction'
125+
result[k_zd], result[k_az] = camera_to_horizontal(
126+
prediction_x, prediction_y,
127+
pointing_position_zd, pointing_position_az,
128+
)
112129
result['theta_deg'] = calc_theta_camera(
113130
prediction_x,
114131
prediction_y,

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
author_email='kai.bruegge@tu-dortmund.de',
3232
license='MIT',
3333
packages=find_packages(),
34+
python_requires='>=3.7',
3435
setup_requires=['pytest-runner'],
3536
tests_require=['pytest'],
3637
install_requires=[
37-
'astropy', # in anaconda
38+
'astropy~=4.2', # in anaconda
3839
'click', # in anaconda
3940
'h5py', # in anaconda
4041
'joblib', # in anaconda
@@ -78,7 +79,6 @@
7879
'Natural Language :: English',
7980
'Operating System :: OS Independent',
8081
'Programming Language :: Python',
81-
'Programming Language :: Python :: 3.6',
8282
'Programming Language :: Python :: 3.7',
8383
'Programming Language :: Python :: 3.8',
8484
'Programming Language :: Python :: 3 :: Only',

0 commit comments

Comments
 (0)