<commit_before>import os
import h5py
import numpy as np
from ibex.data_structures import swc

def ReadMetaData(prefix):
    # generate the meta data default filename
    filename = 'meta_data/' + prefix + '.meta'

    # open the meta data filename
    with open(filename, 'r') as fd:
        meta_data = fd.readlines()
        resolutions = meta_data[1].split('x')

    # return the resolution in nanometers (z, y, x)
    return (int(resolutions[2]), int(resolutions[1]), int(resolutions[0]))



def ReadH5File(filename, dataset):
    # read the h5py file
    with h5py.File(filename, 'r') as hf:
        data = np.array(hf[dataset])

    # return the data
    return data

<commit_msg>dataIO: added ability to write h5 files<commit_after>import os
import h5py
import numpy as np
from ibex.data_structures import swc

def ReadMetaData(prefix):
    # generate the meta data default filename
    filename = 'meta_data/' + prefix + '.meta'

    # open the meta data filename
    with open(filename, 'r') as fd:
        meta_data = fd.readlines()
        resolutions = meta_data[1].split('x')

    # return the resolution in nanometers (z, y, x)
    return (int(resolutions[2]), int(resolutions[1]), int(resolutions[0]))



def ReadH5File(filename, dataset):
    # read the h5py file
    with h5py.File(filename, 'r') as hf:
        data = np.array(hf[dataset])

    # return the data
    return data


def WriteH5File(data, filename, dataset):
    with h5py.File(filename, 'w') as hf:
        hf.create_dataset(dataset, data=data)


{'fraction_non_alphanumeric': 0.11118378024852844, 'fraction_numerical': 0.012426422498364944, 'mean_word_length': 3.346590909090909, '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': '1833821', 'n_tokens_mistral': 496, 'n_tokens_neox': 484, 'n_words': 155}