nel-lab / mesmerize-core

High level pandas-based API for batch analysis of Calcium Imaging data using CaImAn
Other
58 stars 15 forks source link

Evaluate Bleaching on the movie #258

Closed zhouyi0812 closed 9 months ago

zhouyi0812 commented 9 months ago

Hello, I want to see if my movie is bleaching and trying to get a graph for the mean project on each frames or in between certain frames. I am not sure how I could integrate with the mes platform. Or, how can I get the numbers for mean projection on each frame? Thank you!!

kushalkolar commented 9 months ago

Assuming dimension 0 is time:

array.mean(axis=0)

On Mon, Dec 4, 2023, 17:08 Yi Zhou @.***> wrote:

Hello, I want to see if my movie is bleaching and trying to get a graph for the mean project on each frames or in between certain frames. I am not sure how I could integrate with the mes platform. Or, how can I get the numbers for mean projection on each frame? Thank you!!

— Reply to this email directly, view it on GitHub https://github.com/nel-lab/mesmerize-core/issues/258, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRCV3RVQHDFASGKFQPDYHZCWHAVCNFSM6AAAAABAGWBJ6SVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAZDIOBUG4YTIOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

zhouyi0812 commented 9 months ago

So this code supposed to use after mc? mcorr_movie = df.iloc[0].mcorr.get_output() like this: mcorr_movie.mean(axis=0)

kushalkolar commented 9 months ago

Memmaps are arrays.

You would benefit from a basic tutorial on numpy: https://youtu.be/ZB7BZMhfPgk?si=wytdpIYIdQwn-JlI

On Mon, Dec 4, 2023, 17:44 Yi Zhou @.***> wrote:

So this code supposed to use after mc? mcorr_movie = df.iloc[0].mcorr.get_output() mcorr_movie.array.mean(axis=0) AttributeError: 'memmap' object has no attribute 'array'

— Reply to this email directly, view it on GitHub https://github.com/nel-lab/mesmerize-core/issues/258#issuecomment-1839647972, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHXXRBXOT5IHNOJ2LG554DYHZG3NAVCNFSM6AAAAABAGWBJ6SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZZGY2DOOJXGI . You are receiving this because you commented.Message ID: @.***>

zhouyi0812 commented 9 months ago

I think I figure out this and want to post my code here if someone needs it

frame_means = []

for frame in mcorr_movie: frame_mean = frame.mean() frame_means.append(frame_mean)

frame_means = mcorr_movie.mean(axis=(1, 2)) frame_means num_data_points = frame_means.shape[0]

print(f"Number of data points in frame_means: {num_data_points}") plt.plot(frame_means)

plt.title('Mean Intensity of Each Frame') plt.xlabel('Frame Number') plt.ylabel('Mean Intensity') plt.show()

kushalkolar commented 9 months ago

Yup that's right, sorry axis=0 gives the mean image.