solarcarsim/notebooks/testing.ipynb

66 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-12-15 19:54:23 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Array([ 0.0000000e+00, -2.5544850e-07, -1.4012958e-06, ...,\n",
" -1.1142221e-02, -1.1067827e-02, -1.1001030e-02], dtype=float32)"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import jax\n",
"import jax.numpy as jnp\n",
"from solarcarsim.physsim import CarParams, fractal_noise_1d\n",
"\n",
"\n",
"key = jax.random.key(0)\n",
"\n",
"slope = fractal_noise_1d(key, 10000, scale=1200, height_scale=0.08)\n",
"\n",
"slope"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# get an array of positions\n",
"positions = jnp.array([1.1,2.2,3.3,5,200.0], dtype=jnp.float32)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}