Gwydion allows users to generate pseudo-random scientific data easily.
Project description
Gwydion
Gwydion allows users to generate pseudo-random scientific data easily.
In the spirit of Faker, Gwydion allows you to generate pseudo-random data using a simple, clean, and customisable API.
Gwydion is named after a trickster from Welsh mythology.
Installation
You can install from PyPI with
pip install gwydion
Examples
Some basic examples of Gwydion objects are given below.
In the first example, we create a simple Linear object, given by the mathematical relationship y = mx + c. When parameters are not set by the user, Gwydion objects will default to suitable random values. Objects will also, by default, add some random noise to the y-data. In the example below we allow the Linear object to generate all of the parameters, but set the number of data points N manually.
from gwydion import Linear lin = Linear(N=6) x, y = lin.data print(x, y, sep='\n') # [ 0. 2. 4. 6. 8. 10.] # [ -0.17387604 5.59216341 11.77162695 17.70041889 23.55609025 28.67617757]
In this second example, an Exponential function is created with various manually selected parameters. Exponential functions are given by y = I * base**(k*x). In the example below we have set:
The number of data points N = 3,
The intensity I = 10,
The exponent multiplier k = -1,
The x-limits xlim = (0, 10),
And chosen to not add any random noise to the data add_rand = False.
For the Exponential object the default base is not random, but is instead to Euler’s number e = 2.71828.... This fact, combined with k = -1, means that our object below is effectively giving us exponential decay.
from gwydion import Exponential exp = Exponential(N=3, I=10, k=-1, xlim=(0,10), add_rand=False) x, y = exp.data print(x, y, sep='\n') # [ 0. 5. 10.] # [ 1.00000000e+01 6.73794700e-02 4.53999298e-04]
Finally, let’s look at how Gwydion objects work with matplotlib. In the example below, we generate 5 Sine objects using a list comprehension. We can then use the plot function to plot each data set easily.
from gwydion import Sine import matplotlib.pyplot as plt sines = [Sine(xlim=(0,5)) for _ in range(5)] fig, ax = plt.subplots() for sine in sines: sine.plot(ax=ax) ax.set_xlabel('Time') ax.set_ylabel('Intensity') plt.show()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gwydion-0.1.zip
.
File metadata
- Download URL: gwydion-0.1.zip
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 678214f8db98b8d22c06d5a4033cba7ea7c8f28cec956d3f10a4e6f41bd7cd7c |
|
MD5 | d74558e4b4e94aa1fd43a1635b1d39c4 |
|
BLAKE2b-256 | f9365081420e531dd70abe61bd438c6c0ecfe4a5acca7b2693b26a8b0163349e |
File details
Details for the file gwydion-0.1.win-amd64.exe
.
File metadata
- Download URL: gwydion-0.1.win-amd64.exe
- Upload date:
- Size: 233.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd3f4cb5a83ae778dffb9fbb3cbc6fb1a969a97da87961b09983bd83e2427a9f |
|
MD5 | 4d9f513a798f5684f5f94eb7271cb2c4 |
|
BLAKE2b-256 | ea066c0ac8074c728b4a294b86ee067e4b41e7507ac996466fdc01fa661e8372 |