amaggi/waveloc — pull request #46 by amaggi (2012-10-23 15:58:55+00:00)
Title: Adding probability density location back into the code

This mostly concerns the probability location code, so should not break anything. I've tested it with the full battery of tests and all is ok.

@nlanget
One exception to the above statement : I've also re-fixed the getting of first start and last end times of stacks before combining (in locations_trigger). Previous version assumed that the end time of file n would be later than that of file n-1, which is not always the case, especially if the directory contains a mix of files. This version now reads start and end times from all files before choosing first start and last end times:

```
# get start times (get first and last times)
start_times=[]
end_times=[]
for fname in stack_files:
f_stack = h5py.File(fname,'r')
max_val = f_stack['max_val']
start_times.append(utcdatetime.UTCDateTime(max_val.attrs['start_time']))
end_times.append( utcdatetime.UTCDateTime(max_val.attrs['start_time'])+dt*len(max_val))
f_stack.close()

first_start_time = min(start_times)
last_end_time = max(end_times)

nt_full=int((last_end_time-first_start_time)/dt)+1

```