<commit_before><commit_msg>Adding plots.py which includes some basic plotting functions<commit_after>import numpy
import math

import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors
from mpl_toolkits.axes_grid1 import ImageGrid, Divider


def set_plot_params():
	fig_width_pt = 240.0  # Get this from LaTeX using \showthe\columnwidth
	inches_per_pt = 1.0/72.27               # Convert pt to inch
	golden_mean = (math.sqrt(5)-1.0)/2.0         # Aesthetic ratio
	fig_width = fig_width_pt*inches_per_pt  # width in inches
	fig_height = fig_width*golden_mean      # height in inches
	fig_size =  [fig_width,fig_height]
	params = {'backend': 'ps', 'axes.labelsize': 10,'text.fontsize': 10, 'legend.fontsize': 10, 'xtick.labelsize': 10, 'ytick.labelsize': 10,
		 'text.usetex': True, 'figure.figsize': fig_size, 'font.weight': "bolder", 'ytick.major.pad': 10, 'xtick.major.pad':10, 'axes.titlesize':10, 'ps.distiller.res'  : 24000}
	return params


def plot_slice(cube, index, filename):

	mpl.rcParams.update(set_plot_params())

	fig=plt.figure()
	ax = fig.add_subplot(111)
	plt.subplots_adjust(left  = 0.1,  right = 0.9, bottom = 0.22, top = 0.95)

	mean=numpy.mean(numpy.log(cube[index,:,:]))
	std=numpy.std(numpy.log(cube[index,:,:]))

	plate=((numpy.log(cube[index,:,:])-mean)/std)

	cax=ax.imshow(plate, vmin=-3, vmax=3.)
	cbar=fig.colorbar(cax, ticks=[-3,-2,-1,0,1,2,3],)
	cbar.set_label(r'$\ln \rho$' )
	ax.set_xticklabels([])
	ax.set_yticklabels([])
#	ax.set_xlabel("$d /kpc$")
#	ax.set_ylabel("$A_{6250}$")
#	ax.set_xlim(0,8.001)
#	ax.set_ylim(0,4)
#	ax.set_yticks([0,1,2,3,4])

	plt.savefig(filename)

{'fraction_non_alphanumeric': 0.17330067360685855, 'fraction_numerical': 0.04592774035517452, 'mean_word_length': 4.877697841726619, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5535987', 'n_tokens_mistral': 745, 'n_tokens_neox': 683, 'n_words': 119}