Gravar-mail: State-dependent network reconstruction from calcium imaging signals