<jupyter_start><jupyter_text>import packages & selct dataset<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
from scipy import spatial
import os
import h5py
import importlib
import glob
import yaml
import sys

import mosaic_topog.utilities as util
import mosaic_topog.flsyst as flsyst
import mosaic_topog.show as show
import mosaic_topog.calc as calc

data_path = 'C:\\Users\\schle\Documents\\GitHub\\Incubator-2022-Geometry-of-Color\\CSV data all OCT locs Jan 2022\\'
save_path = 'C:\\Users\\schle\Documents\\Incubator Data\\'

subject = np.asarray(['AO001R', 'AO008R'])
angle = np.asarray(['temporal', 'nasal', 'superior', 'inferior'])
eccentricity = np.asarray(['1.5', '4', '10'])

coord_fltype = '.csv'
img_fltype = '.png'

dist_unit = 'pixels'

filetypes = [coord_fltype, img_fltype]

conetype_ids = ['all','L','M','S','unclassed']

conetype_colors = ['y','r','g','b','k']
conetype_sizes = [10, 10, 10, 30]

bin_width = 5

num_mc = 100 # number of monte carlo mosaics to generate

categories = [subject, angle, eccentricity]

save_new = 2 # change to strings
save_cats = {'meta','input_data','intracone_dists'}<jupyter_output><empty_output><jupyter_text>load in coordinate data and images<jupyter_code>[coord_data, coord_mosaics, coord_index,coord_flnames] = flsyst.getConeData(data_path,subject,angle,eccentricity,conetype_ids,filetypes[0])
[img_data, img_mosaics, img_index_img_flnames] = flsyst.getConeData(data_path,subject,angle,eccentricity,conetype_ids,filetypes[1])<jupyter_output><empty_output><jupyter_text>plot cones on the image<jupyter_code># for each mosaic we have an image of...
axes = []
for ind,mos in enumerate(img_mosaics):
    # get the image
    img = img_data[ind]
    
    # find the same mosaic in our coordinate data 
    # (may or may not be represented by the same number) 
    coord_mos_ind = coord_mosaics.index(mos)
    
    # pull all coone coordinate filse associated with this mosaic
    coord_mos = flsyst.getDataByCatVal(coord_data, coord_index['mosaics'], coord_mos_ind)
    
    # make a dictionary of all coordinate files and their associated conetype_ids
    coords = {}
    for ind,id in enumerate(conetype_ids):
        coords[id] = coord_mos[ind]
    
    axes.append(show.plotOnROI(img, coords, conetype_ids, mos, conetype_colors, title=mos, figsize=10))<jupyter_output><empty_output><jupyter_text>reimport packages in dev, reload in the mosaic data<jupyter_code>[data, mosaics, index, flnames] = flsyst.getConeData(data_path,subject,angle,eccentricity,conetype_ids,filetypes[0])<jupyter_output><empty_output><jupyter_text>load in the save file configuration yaml run cone data through processes according to user settings<jupyter_code>def runProcesses(data_path, subject, angle, eccentricity, conetype_ids, processes, collect_all, save_names):
    for p in processes.keys():
        for ind in processes[p]:
        
            # open save file for writing and add group for this process
            savename = savenames[ind]
            sav = h5py.File(savename, 'w')
            group = sav.create_group(p)

            if p == 'meta':
                print('boop')
            elif p == 'input_data':
                print('boop')
            elif p == "intracone_dists":
                
                
                for ind in processes[p]:
                    
                    
            else:
                print('"' + p + '" is not a valid process. skipping.')

processes, collect_all, savenames = getProcessesToRun(save_path,flnames,save_cats,save_new) 

runProcesses(data_path, subject, angle, eccentricity, conetype_ids, processes, collect_all, save_names)
with open("savefl_config.yml", "r") as stream:
    try:
        sav_cfg = yaml.safe_load(stream)
        print(sav_cfg)
    except yaml.YAMLError as exc:
        print(exc)
processes
possible = globals.copy()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10862290862290862, 'fraction_numerical': 0.010038610038610039, 'mean_word_length': 3.8819095477386933, 'pattern_counts': {'":': 1, '<': 21, '<?xml version=': 0, '>': 21, '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}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '375041', 'license': 'MIT', 'n_tokens_mistral': 1372, 'n_tokens_neox': 1281, 'n_words': 312, 'path': 'preload monte carlo and distance calculations.ipynb', 'repo_name': 'schleuf/Incubator-2022-Geometry-of-Color', 'size': '3885'}