@@ -24,8 +24,13 @@ function get_gti_from_hdu(gtihdu::TableHDU)
2424 gtistart = FITSIO. read (gtihdu,startstr)
2525 gtistop = FITSIO. read (gtihdu,stopstr)
2626
27- return mapreduce (permutedims, vcat,
28- [[a, b] for (a,b) in zip (gtistart, gtistop)])
27+ final_gti = [[a, b] for (a,b) in zip (gtistart, gtistop)]
28+
29+ if isempty (final_gti)
30+ return reshape (Float64[],0 ,2 )
31+ else
32+ return mapreduce (permutedims, vcat, final_gti)
33+ end
2934end
3035
3136function check_gtis (gti:: AbstractMatrix )
@@ -96,7 +101,13 @@ function create_gti_mask(times::AbstractVector{<:Real},gtis::AbstractMatrix{<:Re
96101 end
97102 end
98103
99- return mask, mapreduce (permutedims, vcat, keepat! (new_gtis,new_gti_mask))
104+ keepat! (new_gtis,new_gti_mask)
105+
106+ if isempty (new_gtis)
107+ return mask, reshape (Float64[],0 ,2 )
108+ else
109+ return mask, mapreduce (permutedims, vcat, new_gtis)
110+ end
100111end
101112
102113function create_gti_from_condition (time:: AbstractVector{<:Real} , condition:: AbstractVector{Bool} ;
@@ -124,7 +135,11 @@ function create_gti_from_condition(time::AbstractVector{<:Real}, condition::Abst
124135 end
125136 push! (gtis,[t0, t1])
126137 end
127- return mapreduce (permutedims, vcat, gtis)
138+ if isempty (gtis)
139+ return reshape (Float64[],0 ,2 )
140+ else
141+ return mapreduce (permutedims, vcat, gtis)
142+ end
128143end
129144
130145function operations_on_gtis (gti_list:: AbstractVector{<:AbstractMatrix{T}} ,
@@ -189,7 +204,11 @@ function get_btis(gtis::AbstractMatrix{T}, start_time, stop_time) where {T<:Real
189204 push! (btis, [first (interval), last (interval)])
190205 end
191206
192- return mapreduce (permutedims, vcat, btis)
207+ if isempty (btis)
208+ return reshape (Float64[],0 ,2 )
209+ else
210+ return mapreduce (permutedims, vcat, btis)
211+ end
193212end
194213
195214function time_intervals_from_gtis (gtis:: AbstractMatrix{<:Real} , segment_size:: Real ;
0 commit comments