Skip to content

Commit ee04ac4

Browse files
authored
Merge pull request #38 from GernotMaier/light-curve-bug-fixes
Light curve bug fixes
2 parents d23c7da + 3f16342 commit ee04ac4

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

eventdisplay_anasum/runlist_from_time_bins.C

+25-5
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ void runlist_from_time_bins( string iAnaSumFile, string iMJDIntervalFile, bool i
9393
// loop over all time intervals
9494
for( unsigned n = 0; n < min_max.size(); n++ )
9595
{
96-
bool bFound = false;
97-
9896
vector< int > iRunList;
9997
// loop over all runs
10098
for( int i = 0; i < t->GetEntries(); i++ )
@@ -107,18 +105,40 @@ void runlist_from_time_bins( string iAnaSumFile, string iMJDIntervalFile, bool i
107105
{
108106
iNruns[n]++;
109107
iT[n] += tOn;
110-
bFound = true;
111108
iRunList.push_back( runOn );
112109
}
113110
}
111+
runsPerTimeBin.push_back( iRunList );
112+
}
113+
// check for missing runs
114+
for( int i = 0; i < t->GetEntries(); i++ )
115+
{
116+
t->GetEntry( i );
117+
if( runOn < 0 )
118+
{
119+
continue;
120+
}
121+
bool bFound = false;
122+
for(unsigned int t = 0; t < runsPerTimeBin.size(); t++ )
123+
{
124+
for(unsigned s = 0; s < runsPerTimeBin[t].size(); s++ )
125+
{
126+
if( runOn == runsPerTimeBin[t][s] )
127+
{
128+
bFound = true;
129+
break;
130+
}
131+
}
132+
}
114133
if( !bFound )
115134
{
116135
iMissingRun.push_back( runOn );
117136
cout << "Missing run " << runOn << "\t" << MJDOn << endl;
118137
}
119-
runsPerTimeBin.push_back( iRunList );
138+
}
139+
140+
120141

121-
}
122142

123143
cout << "Total number of missing runs: " << iMissingRun.size() << endl;
124144

v2dl5/light_curves/binary_plotting.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,14 @@ def _get_number_columns_and_rows(self, number):
124124
125125
"""
126126
n_columns = 4
127+
fig_size = (10, 4)
127128
if number > 9:
128129
n_columns = 6
129-
if number > 12:
130+
fig_size = (12, 6)
131+
if number > 16:
130132
n_columns = 8
131-
return n_columns, math.ceil(number / n_columns)
133+
fig_size = (16, 10)
134+
return n_columns, math.ceil(number / n_columns), fig_size
132135

133136
def plot_flux_vs_phase_for_individual_orbits(
134137
self, instrument, file_type=".pdf", figure_dir="./figures/"
@@ -147,9 +150,8 @@ def plot_flux_vs_phase_for_individual_orbits(
147150
y_min, y_max = self._global_flux_extrema(data)
148151
fontsize = 6
149152

150-
n_columns, n_rows = self._get_number_columns_and_rows(len(orbits))
153+
n_columns, n_rows, figsize = self._get_number_columns_and_rows(len(orbits))
151154
self._logger.info(f"Number of columns: {n_columns}, number of rows: {n_rows}")
152-
figsize = (16, 10) if n_rows > 1 else (10, 4)
153155
plt.figure(figsize=figsize)
154156
for i, orbit_id in enumerate(orbits):
155157
axes = plt.subplot(n_rows, n_columns, i + 1)

0 commit comments

Comments
 (0)