Skip to main content

No project description provided

Project description

Keycap Equations for Human-Like and Synthetic Human Movements

The keycap equations model provides a method to generate human-like and synthetic human movements emulating the dynamics of keyboard typing. The system is comprised of a 'Plant', 'Controller', 'Keycap' functions, and a 'Configuration Manager'.

Overview

The model is designed to capture the intricacies of human typing behaviors. As more samples are taken from the model, moving forward on the time axis, the velocity decreases due to the exponential terms in the model. To prevent the model from decaying too rapidly, time series are constrained to a range of 0-1 second with 1000 samples.

Complexity and Variations

  1. n: General Description:The parameter N controls the complexity of the model. Practical Implication: With higher values of N, the model will present variations at different frequencies. Consequently, increasing N will also increase the velocity of the model. For optimal results, it's recommended to keep N between 500 and 5000. It's also beneficial to adjust the N value for individual users. Frequency Domain Explanation: The number of Gaussian curves at different frequencies.

  2. D (Amplitude): General Description: Represents the amplitude of the keycap's response. Practical Implication: The greater the value of D, the faster the keyboard writes. Frequency Domain Explanation: In the context of a frequency domain representation, a larger D corresponds to a higher amplitude of the Gaussian function. It signifies a more dominant frequency component.

  3. alpha (Damping Coefficient): General Description: Captures the damping property of the keycap's response. Practical Implication: Variation in alpha leads to variations in the velocity of the key response. Frequency Domain Explanation: In frequency space, a greater value of alpha narrows the Gaussian function, making it more peaky. It's inversely proportional to the standard deviation of the Gaussian, indicating a more concentrated frequency component.

  4. t (Time Variable): General Description: This is the time variable, representing the progression of time in the simulation. Practical Implication: The t values allow us to observe how the keycap response evolves over time.

  5. w (Frequency): General Description: Determines the frequency characteristics of the keycap's response. Practical Implication: The parameter w adds complexity to the key response. In simple terms, it can be thought of as controlling the "rhythm" of the keyboard writing pattern. Frequency Domain Explanation: In frequency space, w dictates the position of Gaussian functions. A greater w means more the gaussian is more shifted to the right, representing a faster frequency component.

Configuration

The model comes with the provision to load and save configurations, ensuring consistent characteristics across multiple sessions. The values generated within the same session, will have similar characteristics. The loading and saving of configurations is managed by the Configuration Manager.

Classes Explained

Plant

The Plant class represents a component in a control system. It's responsible for generating model values using a controller and converting velocities into time values.

  • velocities_to_time: Converts an array of velocities to time values.
  • generate_model: Produces model values utilizing the controller.
  • default_design_controller: Generate parameters by default.

Keycap

Defines the keycap function and the model generation mechanism.

  • keycap_function: Represents the behavior of a single keycap, determining its effect based on given parameters.
  • generate_keycaps: Produces a list of multiple keycap functions.
  • generate_model: Creates the model as a linear combination of n keycap functions.

Controller

The Controller class manages parameters and constraints for the keycap model. It ensures the keyboard model operates correctly by constraining the generated values.

  • generate_n: Randomly generates n values.
  • generate_D: Randomly produces D values.
  • generate_alpha: Produces alpha values.
  • generate_w: Generates w values based on an increasing pattern.
  • generate_model_values: Creates model values for a given time series and enforces velocity constraints.

ConfigurationManager

The ConfigurationManager class is essential for maintaining session consistency. It offers methods to save and retrieve configurations for controllers. This ensures that a session can continue with the same characteristics, offering a seamless user experience.

  • save: Saves a controller's configuration.
  • load: Retrieves a saved controller configuration.

How to use

This demonstration will show you how to generate model values and convert velocities to time durations.

The code

if __name__ == "__main__":
    # Initialization:

    # Create an instance of the Controller class.
    controller = Controller()

    # Create an instance of the ConfigurationManager for saving/loading configurations.
    manager = ConfigurationManager()

    # Instantiate a Plant with the above controller.
    plant = Plant(controller)

    # Default design the controller
    plant.default_design_controller()

    # Generate model values:
    t = np.linspace(0, 1, 1000)
    velocities = plant.generate_model(t)

    # Convert the generated velocities to time durations between key presses.
    times = plant.velocities_to_time(velocities)

    # Print the results:
    print("Velocities: ", velocities)
    print("Times: ", times)

Explanation:

Initialization:

Controller Instance: We start by creating an instance of the Controller class. This will be our main controller to manage parameters for the keyboard model. ConfigurationManager Instance: This is used to save and load the configurations of our controllers. It's essential if you want the model's behavior to remain consistent across sessions. Plant Creation:

The Plant object is essentially the system being controlled by the Controller. In this context, the Plant simulates the behavior of the keyboard.

Custom Design (Optional):

It is possible to set values for the controller's parameters. Read the Controller documentation for more information. You can redfine custom logic for the parameters D,w which determines the velocity of the keycap.

Generating Model Values:

Using np.linspace(0, 1, 1000), we're creating a linear space of 1000 time points between 0 and 1. plant.generate_model(t) will use the current controller configuration to generate velocities over this time range.

Output:

With plant.velocities_to_time(velocities), we convert the velocities to difference in key press times. You can call plant.generate_model(t) multiple times to generate different variations of the model. Then you can take the timing differences and assign them to the key presses of a keyboard.

Configuration Management:

One of the powerful features is the ability to save and load configurations using the ConfigurationManager. The manager object can be used to save your controller's configuration and later load it. This ensures consistency in the model's behavior across different sessions.

Example usage to save and load configuration:

controller.save_configuration(manager, "UID")
loaded_controller = Controller.load_configuration(manager, "UID")

This is important for bypassing detection system!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keycap-1.0.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keycap-1.0.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file keycap-1.0.1.tar.gz.

File metadata

  • Download URL: keycap-1.0.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for keycap-1.0.1.tar.gz
Algorithm Hash digest
SHA256 33be4f19b2158ac3758342ec071c8bb414b47669d162f19ff53c889d1ff45eb6
MD5 3f39a8749cef273c83c3944ab5e18e7f
BLAKE2b-256 472f2e3ae598f5ed90d0bd0c70ebe538d15b74caa50bf1d3b4c1fcc778dfb1c2

See more details on using hashes here.

File details

Details for the file keycap-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: keycap-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for keycap-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1a281178882fc86a33b23d0cb590e8a4a1f131766c56b67b8508233791cb33aa
MD5 c2e8e20b6becc5ae0ad8afaf6a9185e9
BLAKE2b-256 a4e374fd39cc857eb03ee344e8fe0c699a1c97f1f3a69fdfb035f96bad96fbfa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page