Skip to content
Snippets Groups Projects
Commit f715202b authored by Ronald Jäpel's avatar Ronald Jäpel
Browse files

update README.md

parent e106b676
No related branches found
No related tags found
No related merge requests found
# The CADET-Research Data Management toolbox # The CADET-Research Data Management toolbox
## Getting started ## Getting started
### Installation ### Installation
CADET-RDM can be installed using CADET-RDM can be installed using
```pip install cadet-rdm``` ```pip install cadet-rdm```
### Initialize Project Repository ### Initialize Project Repository
Create a new project repository or convert an existing repository into a CADET-RDM repo: Create a new project repository or convert an existing repository into a CADET-RDM repo:
```bash ```bash
cadet-rdm initialize-repo <path-to-repo> cadet-rdm initialize-repo <path-to-repo>
``` ```
or from python or from python
```python ```python
from cadetrdm import initialize_repo from cadetrdm import initialize_repo
initialize_repo(path_to_repo) initialize_repo(path_to_repo)
``` ```
The `output_folder_name` can be given optionally. It defaults to `output`. The `output_folder_name` can be given optionally. It defaults to `output`.
### Use CADET-RDM in Python ### Use CADET-RDM in Python
#### Tracking Results #### Tracking Results
```python ```python
...@@ -47,14 +53,14 @@ if __name__ == '__main__': ...@@ -47,14 +53,14 @@ if __name__ == '__main__':
write_data_to_file(data, output_filepath) write_data_to_file(data, output_filepath)
analysis_results = analyse_data(data) analysis_results = analyse_data(data)
figure_path=repo.output_data("analysis/regression.png") figure_path = repo.output_data("analysis/regression.png")
plot_analysis_results(analysis_results, figure_path) plot_analysis_results(analysis_results, figure_path)
``` ```
#### Sharing Results #### Sharing Results
To share your project code and results with others, you need to create remote repositories on e.g. To share your project code and results with others, you need to create remote repositories on e.g.
[GitHub](https://github.com/) or GitLab. You need to create a remote for both the _project_ repo and the [GitHub](https://github.com/) or GitLab. You need to create a remote for both the _project_ repo and the
_results_ repo. _results_ repo.
...@@ -64,6 +70,7 @@ Once created, the remotes need to be added to the local repositories. ...@@ -64,6 +70,7 @@ Once created, the remotes need to be added to the local repositories.
cadet-rdm add-remote-to-repo <path_to_repo> git@<my_git_server.foo>:<project>.git cadet-rdm add-remote-to-repo <path_to_repo> git@<my_git_server.foo>:<project>.git
cadet-rdm add-remote-to-repo <path_to_repo/output_folder> git@<my_git_server.foo>:<project>_output.git cadet-rdm add-remote-to-repo <path_to_repo/output_folder> git@<my_git_server.foo>:<project>_output.git
``` ```
or in Python: or in Python:
```python ```python
...@@ -72,7 +79,7 @@ repo.add_remote("git@<my_git_server.foo>:<project>.git") ...@@ -72,7 +79,7 @@ repo.add_remote("git@<my_git_server.foo>:<project>.git")
repo.output_repo.add_remote("git@<my_git_server.foo>:<project>_output.git") repo.output_repo.add_remote("git@<my_git_server.foo>:<project>_output.git")
``` ```
Once remotes are configured, you can push all changes to the project repo and the results repos with the Once remotes are configured, you can push all changes to the project repo and the results repos with the
command command
```python ```python
...@@ -80,13 +87,12 @@ command ...@@ -80,13 +87,12 @@ command
repo.push() repo.push()
``` ```
#### Re-using results from previous iterations #### Re-using results from previous iterations
Each result stored with CADET-RDM is given a unique branch name, formatted as: Each result stored with CADET-RDM is given a unique branch name, formatted as:
`<timestamp>_<output_folder>_"from"_<active_project_branch>_<project_repo_hash[:7]>` `<timestamp>_<output_folder>_"from"_<active_project_branch>_<project_repo_hash[:7]>`
With this branch name, previously generated data can be loaded in as input data for With this branch name, previously generated data can be loaded in as input data for
further calculations. further calculations.
```python ```python
...@@ -100,4 +106,30 @@ the correct branch name from the path to the file within the cache ...@@ -100,4 +106,30 @@ the correct branch name from the path to the file within the cache
cached_array_path = repo.input_data(source_file_path="output_cached/<branch_name>/raw_data/data.csv") cached_array_path = repo.input_data(source_file_path="output_cached/<branch_name>/raw_data/data.csv")
``` ```
### Using results from another repository
You can load in results from another repository to use in your project using the CLI:
```bash
cd path/to/your/project
cadet-rdm import-remote-repo <URL> <branch_name>
cadet-rdm import-remote-repo <URL> <branch_name> --target_repo_location <path/to/where/you/want/it>
```
This will store the URL, branch_name and location in the .cadet-rdm-cache.json file, like this:
```json
{
"__example/path/to/repo__": {
"source_repo_location": "git@jugit.fz-juelich.de:IBG-1/ModSim/cadet/agile_cadet_rdm_presentation_output.git",
"branch_name": "output_from_master_3910c84_2023-10-25_00-17-23",
"commit_hash": "6e3c26527999036e9490d2d86251258fe81d46dc"
}
}
```
You can use this file to load the remote repositories based on the cache.json with
```bash
cadet-rdm fill_data_from_cadet_rdm_json
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment