Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation - Read numpy data #523

Open
PythonFZ opened this issue May 30, 2022 · 1 comment
Open

Documentation - Read numpy data #523

PythonFZ opened this issue May 30, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@PythonFZ
Copy link
Member

PythonFZ commented May 30, 2022

Add: How to use numpy input data to the documentation

Working solution can be found:

def test_read_script_input(tmp_path):
n_configs = 10
n_parts = 4
n_dims = 2
time_step = 0.1
sp_name = "test_species"
positions = np.random.rand(*(n_configs, n_parts, n_dims))
velocities = np.random.rand(*(n_configs, n_parts, n_dims))
properties = [
PropertyInfo(name="Positions", n_dims=n_dims),
PropertyInfo(name="Velocities", n_dims=n_dims),
]
species_list = [
SpeciesInfo(name=sp_name, n_particles=n_parts, mass=1234, properties=properties)
]
metadata = TrajectoryMetadata(
species_list=species_list,
n_configurations=n_configs,
sample_rate=1,
box_l=3 * [1.1],
)
data = TrajectoryChunkData(species_list=species_list, chunk_size=n_configs)
data.add_data(positions, 0, sp_name, "Positions")
data.add_data(velocities, 0, sp_name, "Velocities")
proc = script_input.ScriptInput(data=data, metadata=metadata, name="test_name")
project = mdsuite.Project(name="test_proj", storage_path=tmp_path)
project.add_experiment(name="test_experiment", timestep=time_step)
exp = project.experiments["test_experiment"]
exp.add_data(proc)

@PythonFZ PythonFZ added the documentation Improvements or additions to documentation label May 30, 2022
@SamTov
Copy link
Member

SamTov commented Jun 1, 2022

Using numpy data for a new experiment?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants