hacky code to measure heartrate from calcium imaging data