<commit_before>"""
Commands for running the examples files.
"""

# CEBHACKALERT! Still being written!
# Not sure "setup.py" is the right name.  Just translating the
# Makefile for now...but we definitely have topographica by now so we
# could do this differently.

# Has none of the Makefile's dependency processing, so just does
# what you tell it (i.e. over-writes existing files).



from os import spawnv, P_WAIT
from sys import argv, exec_prefix
from os.path import join


# location of the topographica script
topographica = join(exec_prefix,"topographica")

# location of examples dir
examples = join(exec_prefix,"examples")

# first arg is script name
command_names = argv[1:len(argv)]


### Convenience functions
def snapshot(filename):
    """Return a command for saving a snapshot named filename."""
    return "from topo.commands.basic import save_snapshot ; save_snapshot('"+join(examples,filename)+"')"
    
def or_analysis():
    """Return a command for orientation analysis."""
    return "from topo.commands.analysis import measure_or_pref,measure_position_pref,measure_cog,measure_or_tuning_fullfield; \<commit_msg>Get topographica's location in a way that also works on Windows.<commit_after>"""
Commands for running the examples files.
"""

# CEBHACKALERT! Still being written!
# Not sure "setup.py" is the right name - maybe run.py?
#
# Just translating the Makefile for now...but we definitely have
# topographica by now so we could do this differently.
#
# Has none of the Makefile's dependency processing, so just does
# what you tell it (i.e. over-writes existing files).



from os import spawnv, P_WAIT
from sys import argv, executable
from os.path import join, split

# (same ALERT as in Filename parameter)
topographica_path = split(split(executable)[0])[0]

# location of the topographica script
topographica = join(topographica_path,"topographica")

# location of examples dir
examples = join(topographica_path,"examples")

# first arg is script name
command_names = argv[1:len(argv)]


### Convenience functions
def snapshot(filename):
    """Return a command for saving a snapshot named filename."""
    return "from topo.commands.basic import save_snapshot ; save_snapshot('"+join(examples,filename)+"')"
    
def or_analysis():
    """Return a command for orientation analysis."""
    return "from topo.commands.analysis import measure_or_pref,measure_position_pref,measure_cog,measure_or_tuning_fullfield; \
{'fraction_non_alphanumeric': 0.09373720835038886, 'fraction_numerical': 0.001637331150225133, 'mean_word_length': 5.094763092269327, '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': '7273936', 'n_tokens_mistral': 706, 'n_tokens_neox': 689, 'n_words': 261}