Config.py¶
Config.py¶
This class is instantiated to aquire values from the config file.
- class Config.Config(filename)[source]¶
This class is instantiated to aquire values from the config file for the evolutionary run. This object is given to other objects so they can access value sin the config.
- __init__(filename)[source]¶
Provide the file to be interpreted by the config file.
- Parameters:
filename (str) – The file path of the configuration file.
- __log_error(level, *error)¶
Emit an error-level log. This function is fulfilled through the logger.
- __log_event(level, *event)¶
Emit an event-level log. This function is fulfilled through the logger.
- __log_info(level, *info)¶
Emit an info-level log. This function is fulfilled through the logger.
- __log_warning(level, *warning)¶
Emit a warning-level log. This function is fulfilled through the logger.
- add_logger(logger)[source]¶
Adds logger to the Configuration actions
- Parameters:
logger (Logger) – The logger object to log Configuration actions.
- get_combined_mode()[source]¶
Selects the current Combined Mode Evolution will be using. These modes are listed below. We verify that only one of the following modes can be returned.
- ADD
Multiplies weights by fitnesses, then adds the resulting terms to get overall fitness
- MULT
Raises fitnesses to the power of their weights, then multiplies the resulting terms to get overall fitness
- Returns:
The config’s selected combined mode from the list of possible modes.
- Return type:
- get_desired_frequency()[source]¶
This returns the desired frequency from the config file. It is automatically converted into an integer. If the desired frequency is negitive, this will exit the running program.
- Returns:
The desired frequency. Garunteed non-negitive.
- Return type:
- get_fitness_func()[source]¶
Selects the current Fitness Function Evolution will be using. These modes are listed below We verify that only one of the following modes can be returned.
- VARIANCE
Variance maximization fitness function. The fitness is the absolute difference of voltage readings from consecutive time steps. Selects for Noise.
- PULSE_COUNT
Left in for backwards-compatability. Refers to SENSITIVE_PULSE_COUNT.
- TOLERANT_PULSE_COUNT
This uses the number of pulses to generate a fitness. To do this, it compares the calculated frequency from the number of pulses in a second to the target frequency. The closer to the target, the higher the fitness. This fitness function is more ‘tolerant’ of errors, meaning it assigns greater fitness values to circuits that only have slight errors.
- SENSITIVE_PULSE_COUNT
This uses the number of pulses to generate a fitness. To do this, it compares the calculated frequency from the number of pulses in a second to the target frequency. The closer to the target, the higher the fitness. This fitness function is more ‘sensitive’ of errors, meaning it has an abrupt drop-off in fitness scores even for slight errors.
- TONE_DISCRIMINATOR
This randomly alternates between a 1kHz and 10kHz signal sent to the FPGA, and reads in a high/low output from the FGPA to get the predicted frequency.
- Returns:
The config’s selected fitness function from the list of possible modes.
- Return type:
- get_fitness_parameters(param)[source]¶
Returns the value of a parameter from the “FITNESS PARAMETERS” section of the config file.
- get_ga_parameters(param)[source]¶
Returns the value of a parameter from the “GA PARAMETERS” section of the config file.
- get_hardware_parameters(param)[source]¶
Returns the value of a parameter from the “HARDWARE PARAMETERS” section of the config file.
- get_init_parameters(param)[source]¶
Returns the value of a parameter from the “INITIALIZATION PARAMETERS” section of the config file.
- get_logging_parameters(param)[source]¶
Returns the value of a parameter from the “LOGGING PARAMETERS” section of the config file.
- get_num_samples()[source]¶
This returns the number of samples from the config file.
- Returns:
The Number of samples from “NUM_SAMPLES”
- Return type:
- get_plotting_parameters(param)[source]¶
Returns the value of a parameter from the “PLOTTING PARAMETERS” section of the config file.
- get_pulse_weight()[source]¶
This returns the pulse weight from the config file. This is the pulse weight used in the combined_mode operation specified previously.
- Returns:
The pulse weight.
- Return type:
- get_sensitivity_parameters(param)[source]¶
Returns the value of a parameter from the “FITNESS SENSITIVITY PARAMETERS” section of the config file.
- get_simulation_mode()[source]¶
Selects the current mode the simulation will run in. These modes are listed below. We verify that only one of the following modes can be returned.
- FULLY_INTRINSIC
Runs the experiment on the actual hardware. Full normal experiment setup required.
- INTRINSIC_SENSITIVITY
Performs Sensitivity analysis. This is done intrensically, but it runs one circuit many times instead of performing evolution on it.
- SIM_HARDWARE
Simulation mode. This uses an arbitrary function operating on the compiled binary files that are used to specify the hardware configuration.
- FULLY_SIM
Simulation mode. Operates on a small array of arbitrary bit values.
- Returns:
The config’s selected simulation mode from the list of possible modes.
- Return type:
- get_stop_parameters(param)[source]¶
Returns the value of a parameter from the “STOPPING CONDITION PARAMETERS” section of the config file.
- get_system_parameters(param)[source]¶
Returns the value of a parameter from the “SYSTEM PARAMETERS” section of the config file.
- get_top_parameters(param)[source]¶
Returns the value of a parameter from the “TOP-LEVEL PARAMETERS” section of the config file.