MulaiMulai sekarang secara gratis

The structure of .mat in Python

Here, you'll discover what is in the MATLAB dictionary that you loaded in the previous exercise.

The file 'albeck_gene_expression.mat' is already loaded into the variable mat. The following libraries have already been imported as follows:

import scipy.io
import matplotlib.pyplot as plt
import numpy as np

Once again, this file contains gene expression data from the Albeck Lab at UCDavis.

Latihan ini adalah bagian dari kursus

Introduction to Importing Data in Python

Lihat Kursus

Petunjuk latihan

  • Use the method .keys() on the dictionary mat to print the keys. Most of these keys (in fact the ones that do NOT begin and end with '__') are variables from the corresponding MATLAB environment.
  • Print the type of the value corresponding to the key 'CYratioCyt' in mat. Recall that mat['CYratioCyt'] accesses the value.
  • Print the shape of the value corresponding to the key 'CYratioCyt' using the numpy function shape().
  • Execute the entire script to see some oscillatory gene expression data!

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Print the keys of the MATLAB dictionary
print(____)

# Print the type of the value corresponding to the key 'CYratioCyt'


# Print the shape of the value corresponding to the key 'CYratioCyt'


# Subset the array and plot it
data = mat['CYratioCyt'][25, 5:]
fig = plt.figure()
plt.plot(data)
plt.xlabel('time (min.)')
plt.ylabel('normalized fluorescence (measure of expression)')
plt.show()
Edit dan Jalankan Kode