Skip to content

Commit 8322c1c

Browse files
authored
Merge pull request #26 from fact-project/fix_observation_blocks
Fix observation blocks, fix #25
2 parents c064848 + a16d2b9 commit 8322c1c

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

examples/plot_qla.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from fact import qla
2+
from fact.credentials import create_factdb_engine
3+
import matplotlib.pyplot as plt
4+
5+
6+
db = create_factdb_engine()
7+
8+
data = qla.get_qla_data(20161124, database=db)
9+
binned = qla.bin_qla_data(data, bin_width_minutes=20)
10+
11+
qla.plot_qla(binned)
12+
13+
plt.show()
14+

fact/qla.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ def dorner_binning(data, bin_width_minutes=20):
2020
def groupby_observation_blocks(runs):
2121
''' Groupby for consecutive runs of the same source'''
2222
runs = runs.sort_values('fRunStart')
23-
next_is_different = runs.fSourceName != runs.fSourceName.shift(-1)
24-
next_is_different.iloc[-1] = False
25-
observation_blocks = next_is_different.cumsum()
23+
new_source = runs.fSourceName != runs.fSourceName.shift(1)
24+
observation_blocks = new_source.cumsum()
2625
return runs.groupby(observation_blocks)
2726

2827

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name='pyfact',
6-
version='0.8.1',
6+
version='0.8.2',
77
description='A module containing useful methods for working with fact',
88
url='http://github.com/fact-project/pyfact',
99
author='Maximilian Noethe, Dominik Neise',

0 commit comments

Comments
 (0)