Python में .mat की संरचना
इस अभ्यास में, आप उस MATLAB dictionary की सामग्री जानेंगे जिसे आपने पिछले अभ्यास में लोड किया था.
फ़ाइल 'albeck_gene_expression.mat' पहले से ही वैरिएबल mat में लोड है. निम्नलिखित लाइब्रेरीज़ पहले से इस प्रकार
import की गई हैं:
import scipy.io
import matplotlib.pyplot as plt
import numpy as np
एक बार फिर, इस फ़ाइल में UCDavis की Albeck Lab से gene expression डेटा है.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में डेटा आयात का परिचय
अभ्यास निर्देश
- dictionary
matपर.keys()मेथड का उपयोग करके keys प्रिंट करें. इन keys में से अधिकतर (यानी वे जो '__' से शुरू और समाप्त नहीं होतीं) संबंधित MATLAB environment से आई variables हैं. matमें key'CYratioCyt'से संबंधित value का type प्रिंट करें. याद रखें,mat['CYratioCyt']से value एक्सेस होती है.numpyफंक्शनshape()का उपयोग करके key'CYratioCyt'से संबंधित value का shape प्रिंट करें.- पूरा स्क्रिप्ट चलाएँ ताकि आप oscillatory gene expression डेटा देख सकें!
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# 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()