ComenzarEmpieza gratis

La estructura de .mat en Python

Aquí descubrirás qué hay en MATLAB. que has cargado en el ejercicio anterior.

El archivo 'albeck_gene_expression.mat' ya está cargado en la variable mat. Las siguientes bibliotecas ya se han importado de la siguiente manera:

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

Una vez más, este archivo contiene datos sobre la expresión génica del laboratorio Albeck de la Universidad de California en Davis.

Este ejercicio forma parte del curso

Introducción a la importación de datos en Python

Ver curso

Instrucciones del ejercicio

  • Utiliza el método .keys() en el diccionario mat para imprimir las claves. La mayoría de estas claves (de hecho, las que hacen NOT comienzan y terminan con «__») son variables del entorno MATLAB correspondiente.
  • Imprime el tipo del valor correspondiente a la clave 'CYratioCyt' en mat. Recuerda que mat['CYratioCyt'] accede al valor.
  • Imprime la forma del valor correspondiente a la clave 'CYratioCyt' utilizando la función numpy shape() .
  • ¡Ejecuta el script completo para ver algunos datos de expresión génica oscilatoria!

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# 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()
Editar y ejecutar código