<commit_before>""" Configuration parameters/constants for various parts of the program.

	Author: <NAME>
"""

# File paths:
GIS_FILES = "H:/My Documents/vis/gis/SmallPatches"
CSV_DIR = "H:/My Documents/vis/csv"
MOVIE_FILENAME = "H:/My Documents/vis/movie.mp4"

# Animation options:
FIELD_OF_INTEREST = "Soil.SoilWater.Drainage"
VALUE2VALUE = 'basic' # Value transformation function
HEADER = "Model render" # Header displayed
TIMEWARP = 'delta' # Time warp method used

# Display constants:
BORDER = 20 # Empty space around the image, in pixels.
BROKEN_COLOUR = (0, 0, 255)
DEFAULT_COLOUR = (255, 255, 255)
EDGE_COLOUR = (0, 0, 0)
EDGE_THICKNESS = 1 # Some integer greater than or equal to one.
EDGE_RENDER = True # Whether or not to render edges (plot edges, terrain).
FPS = 2 # 1 does not appear to work for MoviePy?
MAX_FPS = 24 # Maximum allowed FPS
MIN_FPS = 1 # Minimum allowed FPS
MAX_FRAMES_PER_DAY = 5 # Maximum number of frames per day
MIN_FRAMES_PER_DAY = 1 # Minimum number of frames per day
MOVIE_SIZE = (1280, 1024)
SCALE_WIDTH = 20 # Width of the scale, in pixels.
SCALE_DECIMAL_PLACES = 2 # Decimal places to display on the scale.
TEXT_COLOUR = (0, 0, 0) # The colour of any text.
TEXT_HEIGHT = 30 # The height for any fonts.
TEXT_AA = False # Whether or not to antialias the text.

# Other:
DATE_FIELD = "Clock.Today" # Field name for dates.

# Transformation functions:
# These are applied to the data as preprocessing. For instance, change_value
# returns the delta between the current and previous value. Other useful
# functions might scale the data, or remove anomalies.
basic_value = lambda values, index, patch: values[index][patch]
# change_value
change_value = lambda values, index, patch: values[index][patch] - \
	values.get(index - 1, {patch: values[index][patch]})[patch]
#TODO: Other useful functions might be exponential decay based
#	   (with min as the baseline, max as the max)
transformations = {'basic': basic_value,
	'delta': change_value,
	}

# Time mapping functions:
# Basic time map functions; these are functions that accept a list of Values
# and use that to generate a map from a frame to a particular index in the
# values.
def map_basic(values):
	""" Direct map from frames to dates """
	one_value = None
	for value in values:
		if one_value == None:
			one_value = value<commit_msg>Added a per-day field delta<commit_after>""" Configuration parameters/constants for various parts of the program.

	Author: <NAME>
"""

# File paths:
GIS_FILES = "H:/My Documents/vis/gis/SmallPatches"
CSV_DIR = "H:/My Documents/vis/csv"
MOVIE_FILENAME = "H:/My Documents/vis/movie.mp4"

# Animation options:
FIELD_OF_INTEREST = "Soil.SoilWater.Drainage"
VALUE2VALUE = 'field_delta' # Value transformation function
HEADER = "Model render" # Header displayed
TIMEWARP = 'delta' # Time warp method used

# Display constants:
BORDER = 20 # Empty space around the image, in pixels.
BROKEN_COLOUR = (0, 0, 255)
DEFAULT_COLOUR = (255, 255, 255)
EDGE_COLOUR = (0, 0, 0)
EDGE_THICKNESS = 1 # Some integer greater than or equal to one.
EDGE_RENDER = True # Whether or not to render edges (plot edges, terrain).
FPS = 4 # 1 does not appear to work for MoviePy?
MAX_FPS = 24 # Maximum allowed FPS
MIN_FPS = 1 # Minimum allowed FPS
MAX_FRAMES_PER_DAY = 5 # Maximum number of frames per day
MIN_FRAMES_PER_DAY = 1 # Minimum number of frames per day
MOVIE_SIZE = (1280, 1024)
SCALE_WIDTH = 20 # Width of the scale, in pixels.
SCALE_DECIMAL_PLACES = 2 # Decimal places to display on the scale.
TEXT_COLOUR = (0, 0, 0) # The colour of any text.
TEXT_HEIGHT = 30 # The height for any fonts.
TEXT_AA = False # Whether or not to antialias the text.

# Other:
DATE_FIELD = "Clock.Today" # Field name for dates.

# Transformation functions:
# These are applied to the data as preprocessing. For instance, change_value
# returns the delta between the current and previous value. Other useful
# functions might scale the data, or remove anomalies.
basic_value = lambda values, index, patch: values[index][patch]
# Time delta uses the delta between a value and the previous day's result.
time_delta_value = lambda values, index, patch: values[index][patch] - \
	values.get(index - 1, {patch: values[index][patch]})[patch]
# Field delta uses the relative delta between a value and the maximum and
# minimums on one specific day.
#TODO: This is quite inefficient...
def field_delta_value(values, index, patch):
	min_day, max_day = min(values[index].values()), max(values[index].values())
	try:
		return ((values[index][patch] - min_day) / (max_day - min_day))
	except ZeroDivisionError:
		return 0

#TODO: Other useful functions might be exponential decay based
#	   (with min as the baseline, max as the max)
transformations = {'basic': basic_value,
	'time_delta': time_delta_value,
	'field_delta': field_delta_value,
	}

# Time mapping functions:
# Basic time map functions; these are functions that accept a list of Values
# and use that to generate a map from a frame to a particular index in the
# values.
def map_basic(values):
	""" Direct map from frames to dates """
	one_value = None
	for value in values:
		if one_value == None:
			one_value = value
{'fraction_non_alphanumeric': 0.09261770974617323, 'fraction_numerical': 0.018019763611703158, 'mean_word_length': 4.5625, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2576844', 'n_tokens_mistral': 1739, 'n_tokens_neox': 1591, 'n_words': 654}