<commit_before>import sys
import numpy as np

def read_phi(flname, n_steps, n_loci, stride):
	sampled_phis = np.zeros((n_steps / stride, n_loci))
	fl = open(flname)
	current_iter_idx = 0 # index used for storage
	last_iter_idx = 0 # index used to identify when we finish a step
	for ln in fl:
		cols = ln.strip().split(",")
		iter_idx = int(cols[0])
		locus_idx = int(cols[1])
		phi = float(cols[2])
		if current_iter % stride == 0:
			if last_iter_idx != iter_idx:
				last_iter_idx = iter_idx
				current_iter_idx += 1
			sampled_phis[current_iter_idx, locus_idx] = phi
	fl.close()

	return sampled_phis


if __name__ == "__main__":
	bamova_phi_output_flname = sys.argv[1]
	n_steps = int(sys.argv[2])
	n_loci = int(sys.argv[3])
	stride = int(sys.argv[4])
	npy_flname = sys.argv[5]

	matrix = read_phi(bamova_phi_output_flname, n_steps, n_loci, stride)

	np.save(matrix, npy_flname)<commit_msg>Remove stride<commit_after>import sys
import numpy as np

def read_phi(flname, n_steps, n_loci):
	sampled_phis = np.zeros((n_steps, n_loci))
	fl = open(flname)
	current_iter_idx = 0 # index used for storage
	last_iter_idx = 0 # index used to identify when we finish a step
	for ln in fl:
		cols = ln.strip().split(",")
		iter_idx = int(cols[0])
		locus_idx = int(cols[1])
		phi = float(cols[2])
		if current_iter % stride == 0:
			if last_iter_idx != iter_idx:
				last_iter_idx = iter_idx
				current_iter_idx += 1
			sampled_phis[current_iter_idx, locus_idx] = phi
	fl.close()

	return sampled_phis


if __name__ == "__main__":
	bamova_phi_output_flname = sys.argv[1]
	n_steps = int(sys.argv[2])
	n_loci = int(sys.argv[3])
	npy_flname = sys.argv[4]

	matrix = read_phi(bamova_phi_output_flname, n_steps, n_loci)

	np.save(matrix, npy_flname)
{'fraction_non_alphanumeric': 0.119102416570771, 'fraction_numerical': 0.013233601841196778, 'mean_word_length': 4.538216560509555, 'pattern_counts': {'":': 2, '<': 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': '1504611', 'n_tokens_mistral': 762, 'n_tokens_neox': 704, 'n_words': 161}