Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f5da34f

Browse filesBrowse files
committed
DOC: structure blocks of code with only a top real comment line
1 parent d06e572 commit f5da34f
Copy full SHA for f5da34f

File tree

Expand file treeCollapse file tree

1 file changed

+7
-16
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-16
lines changed

‎examples/pylab_examples/mri_with_eeg.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/mri_with_eeg.py
+7-16Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,36 @@
1616

1717
fig = plt.figure("MRI_with_EEG")
1818

19-
"""
20-
Load the data
21-
"""
22-
# Data are 256x256 16 bit integers
19+
# Load the MRI data (256x256 16 bit integers)
2320
dfile = cbook.get_sample_data('s1045.ima.gz')
2421
im = np.fromstring(dfile.read(), np.uint16).astype(float)
2522
im.shape = (256, 256)
2623

27-
"""
28-
Plot the MRI image
29-
"""
24+
# Plot the MRI image
3025
ax0 = fig.add_subplot(2, 2, 1)
3126
ax0.imshow(im, cmap=cm.gray)
3227
ax0.axis('off')
3328

34-
"""
35-
Plot the histogram of MRI intensity
36-
"""
29+
# Plot the histogram of MRI intensity
3730
ax1 = fig.add_subplot(2, 2, 2)
3831
im = np.ravel(im)
3932
im = im[np.nonzero(im)] # Ignore the background
4033
im = im / (2**15) # Normalize
41-
ax1.hist(im, 100)
34+
ax1.hist(im, bins=100)
4235
ax1.xaxis.set_major_locator(MultipleLocator(0.5))
4336
ax1.set_yticks([])
4437
ax1.set_xlabel('Intensity')
4538
ax1.set_ylabel('MRI density')
4639

47-
"""
48-
Plot the EEG
49-
"""
50-
# Load the data
40+
# Load the EEG data
5141
numSamples, numRows = 800, 4
5242
eegfile = cbook.get_sample_data('eeg.dat', asfileobj=False)
5343
print('Loading EEG %s' % eegfile)
5444
data = np.fromstring(open(eegfile, 'rb').read(), float)
5545
data.shape = (numSamples, numRows)
5646
t = 10.0 * np.arange(numSamples) / numSamples
5747

48+
# Plot the EEG
5849
ticklocs = []
5950
ax2 = fig.add_subplot(2, 1, 2)
6051
ax2.set_xlim(0, 10)
@@ -77,7 +68,7 @@
7768
lines = LineCollection(segs, offsets=offsets, transOffset=None)
7869
ax2.add_collection(lines)
7970

80-
# Set the yticks to use axes coords on the y axis
71+
# Set the yticks to use axes coordinates on the y axis
8172
ax2.set_yticks(ticklocs)
8273
ax2.set_yticklabels(['PG3', 'PG5', 'PG7', 'PG9'])
8374

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.