Hi everyone

In the obspy there is a routine called `PPSD.``calculate_histogram`

` `

that allows time restrictions to calculate the ppsd. There is a parameter called **callback(func)**, where is possible to put several time intervals to time restrictions. I don understand how to use callback(function) to put several time intervals to time restriction to estimate ppsd, could you help me please.

I appreciate your cooperation and assistance

Thanks

Hi Edward,

This means that (voluntarily not a “one liner” example here):

```
def mycallback(starttimes):
"""
This callback function returns True for even minutes on Mondays
:param starttimes: list of obspy UTCDateTimes
:return: a boolean array
"""
output = []
for t in starttimes:
t = UTCDateTime(t)
if t.isoweekday() == 2:
# If the timestamp is a Monday (Sunday=1)
if t.minute % 2 == 0:
# If the minute is even:
output.append(True)
else:
output.append(False)
else:
output.append(False)
return output
```

Not sure why you’d want only the even minutes on Mondays… but it’s an explanatory example

cheers,

Thomas