def make_filter_fig(self, filters, filter_start, fignum, _title, num_filters, combine_chans):
		FILTERS_PER_ROW = 16
		MAX_ROWS = 16
		MAX_FILTERS = FILTERS_PER_ROW * MAX_ROWS
		num_colors = filters.shape[0]
		f_per_row = int(ceil(FILTERS_PER_ROW / float(1 if combine_chans else num_colors)))
		filter_end = min(filter_start+MAX_FILTERS, num_filters)
		filter_rows = int(ceil(float(filter_end - filter_start) / f_per_row))
	
		filter_size = int(sqrt(filters.shape[1]))
		fig = pl.figure(fignum)
		fig.text(.5, .95, '%s %dx%d filters %d-%d' % (_title, filter_size, filter_size, filter_start, filter_end-1), horizontalalignment='center') 
		num_filters = filter_end - filter_start
		if not combine_chans:
			bigpic = n.zeros((filter_size * filter_rows + filter_rows + 1, filter_size*num_colors * f_per_row + f_per_row + 1), dtype=n.single)
		else:
			bigpic = n.zeros((3, filter_size * filter_rows + filter_rows + 1, filter_size * f_per_row + f_per_row + 1), dtype=n.single)
	
		for m in xrange(filter_start,filter_end ):
			filter = filters[:,:,m]
			y, x = (m - filter_start) / f_per_row, (m - filter_start) % f_per_row
			if not combine_chans:
				for c in xrange(num_colors):
					filter_pic = filter[c,:].reshape((filter_size,filter_size))
					bigpic[1 + (1 + filter_size) * y:1 + (1 + filter_size) * y + filter_size,
						   1 + (1 + filter_size*num_colors) * x + filter_size*c:1 + (1 + filter_size*num_colors) * x + filter_size*(c+1)] = filter_pic
			else:
				filter_pic = filter.reshape((3, filter_size,filter_size))
				bigpic[:,
					   1 + (1 + filter_size) * y:1 + (1 + filter_size) * y + filter_size,
					   1 + (1 + filter_size) * x:1 + (1 + filter_size) * x + filter_size] = filter_pic
				
		pl.xticks([])
		pl.yticks([])
		if not combine_chans:
			pl.imshow(bigpic, cmap=pl.cm.gray, interpolation='nearest')
		else:
			bigpic = bigpic.swapaxes(0,2).swapaxes(0,1)
			pl.imshow(bigpic, interpolation='nearest')
dataset/ETHPy150Open zygmuntz/kaggle-cifar/shownet.py/ShowConvNet.make_filter_fig/original