farn

Python package to generate an n-dimensional case folder structure applying linear and spatial sampling strategies.

https://github.com/dnv-opensource/farn

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.8%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Python package to generate an n-dimensional case folder structure applying linear and spatial sampling strategies.

Basic Info
Statistics
  • Stars: 1
  • Watchers: 6
  • Forks: 0
  • Open Issues: 1
  • Releases: 28
Created over 4 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Citation

README.md

pypi versions license ci docs

farn

farn is an n-dimensional case generator.

Its primary design goal is to parameterize and execute simulation cases. However, at its core, farn is use-case agnostic and can support a wide spectrum of applications.

The name ‘farn’ is inspired by the Barnsley fractal

farn * runs the sampling of the design space (sampling strategies cover fixed, linSpace, uniformLHS) * generates the corresponding case folder structure * copies arbitrary files from a template folder to case folders * creates case specific parameter files in case folders * executes user-defined shell command sets in case folders * builds case specific OSP (co-)simulation files * runs simulation cases as batch process

Installation

sh pip install farn farn requires the following two (sub-)packages: 1. dictIO: foundation package, enabling farn to handle configuration files in dictIO dict file format. 2. ospx: extension package, enabling farn to generate OSP (co-)simulation files.

However, both get installed automatically with farn (just pip install farn and you're done).

Usage Example

farn provides both an API for use inside Python as well as a CLI for shell execution of core functions.

Reading a farnDict file and creating the corresponding case folder structure: ```py from farn import run_farn

run_farn('farnDict', sample=True, generate=True) ```

The above task can also be invoked from the command line, using the 'farn' command line script installed with farn: sh farn farnDict --sample --generate

For more examples and usage, please refer to farn's documentation.

Further, the farn-demo repository on GitHub is an excellent place for a jumpstart into farn. Simply clone the farn-demo repository to your local machine and click through the demos and related READMEs, by recommendation in the following sequence:

README in root folder -> guides you through installation of farn
\ospCaseBuilder Demo (see README in ospCaseBuilder folder)
\farn Demo (see README in farn folder)
\importSystemStructure  Demo (see README in importSystemStructure folder)

File Format

A farnDict is a file in dictIO dict file format used with farn.

For a documentation of the farnDict file format, see File Format in farn's documentation on GitHub Pages.

For a detailed documentation of the dictIO dict file format used by farn, see dictIO's documentation on GitHub Pages.

Development Setup

1. Install uv

This project uses uv as package manager. If you haven't already, install uv, preferably using it's "Standalone installer" method:
..on Windows: sh powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ..on MacOS and Linux: sh curl -LsSf https://astral.sh/uv/install.sh | sh (see docs.astral.sh/uv for all / alternative installation methods.)

Once installed, you can update uv to its latest version, anytime, by running: sh uv self update

2. Install Python

This project requires Python 3.10 or later.
If you don't already have a compatible version installed on your machine, the probably most comfortable way to install Python is through uv: sh uv python install This will install the latest stable version of Python into the uv Python directory, i.e. as a uv-managed version of Python.

Alternatively, and if you want a standalone version of Python on your machine, you can install Python either via winget: sh winget install --id Python.Python or you can download and install Python from the python.org website.

3. Clone the repository

Clone the farn repository into your local development directory: sh git clone https://github.com/dnv-opensource/farn path/to/your/dev/farn Change into the project directory after cloning: sh cd farn

4. Install dependencies

Run uv sync to create a virtual environment and install all project dependencies into it: sh uv sync

Note: Using --no-dev will omit installing development dependencies.

Note: uv will create a new virtual environment called .venv in the project root directory when running uv sync the first time. Optionally, you can create your own virtual environment using e.g. uv venv, before running uv sync.

5. (Optional) Activate the virtual environment

When using uv, there is in almost all cases no longer a need to manually activate the virtual environment.
uv will find the .venv virtual environment in the working directory or any parent directory, and activate it on the fly whenever you run a command via uv inside your project folder structure: sh uv run <command>

However, you still can manually activate the virtual environment if needed. When developing in an IDE, for instance, this can in some cases be necessary depending on your IDE settings. To manually activate the virtual environment, run one of the "known" legacy commands:
..on Windows: sh .venv\Scripts\activate.bat ..on Linux: sh source .venv/bin/activate

6. Install pre-commit hooks

The .pre-commit-config.yaml file in the project root directory contains a configuration for pre-commit hooks. To install the pre-commit hooks defined therein in your local git repository, run: sh uv run pre-commit install

All pre-commit hooks configured in .pre-commit-config.yaml will now run each time you commit changes.

pre-commit can also manually be invoked, at anytime, using: sh uv run pre-commit run --all-files

To skip the pre-commit validation on commits (e.g. when intentionally committing broken code), run: sh uv run git commit -m <MSG> --no-verify

To update the hooks configured in .pre-commit-config.yaml to their newest versions, run: sh uv run pre-commit autoupdate

7. Test that the installation works

To test that the installation works, run pytest in the project root folder: sh uv run pytest

Meta

Copyright (c) 2024 DNV SE. All rights reserved.

Frank Lumpitzsch - @LinkedIn - frank.lumpitzsch@dnv.com

Claas Rostock - @LinkedIn - claas.rostock@dnv.com

Seunghyeon Yoo - @LinkedIn - seunghyeon.yoo@dnv.com

Distributed under the MIT license. See LICENSE for more information.

https://github.com/dnv-opensource/farn

Contributing

  1. Fork it (https://github.com/dnv-opensource/farn/fork)
  2. Create an issue in your GitHub repo
  3. Create your branch based on the issue number and type (git checkout -b issue-name)
  4. Evaluate and stage the changes you want to commit (git add -i)
  5. Commit your changes (git commit -am 'place a descriptive commit message here')
  6. Push to the branch (git push origin issue-name)
  7. Create a new Pull Request in GitHub

For your contribution, please make sure you follow the STYLEGUIDE before creating the Pull Request.

Owner

  • Name: DNV open source
  • Login: dnv-opensource
  • Kind: organization
  • Location: Norway

Open source from DNV

Citation (CITATION.cff)

title: farn
version: 0.4.1
abstract: >-
  Python package to generate an n-dimensional case folder structure applying linear and spatial sampling strategies.
type: software
authors:
  - name: DNV SE
    address: 'Brooktorkai 18'
    post-code: '20457'
    city: Hamburg
    country: DE
    website: 'https://www.dnv.com/'
  - given-names: Frank
    family-names: Lumpitzsch
    affiliation: DNV
    email: frank.lumpitzsch@dnv.com
    website: 'https://www.linkedin.com/in/frank-lumpitzsch-23013196/'
  - given-names: Claas
    family-names: Rostock
    affiliation: DNV
    email: claas.rostock@dnv.com
    website: 'https://www.linkedin.com/in/claasrostock/?locale=en_US'
  - given-names: Seunghyeon
    family-names: Yoo
    affiliation: DNV
    email: seunghyeon.yoo@dnv.com
    website: 'https://www.linkedin.com/in/seunghyeon-yoo-3625173b/'
keywords:
  - farn
  - OSP
  - fmi
license: MIT
license-url: 'https://dnv-opensource.github.io/farn/LICENSE.html'
url: 'https://dnv-opensource.github.io/farn/README.html'
repository-code: 'https://github.com/dnv-opensource/farn'
message: 'Please cite this software using these metadata.'
cff-version: 1.2.0

GitHub Events

Total
  • Create event: 9
  • Issues event: 8
  • Release event: 2
  • Delete event: 8
  • Push event: 313
  • Pull request event: 14
Last Year
  • Create event: 9
  • Issues event: 8
  • Release event: 2
  • Delete event: 8
  • Push event: 313
  • Pull request event: 14

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 9
  • Total pull requests: 46
  • Average time to close issues: 7 days
  • Average time to close pull requests: 9 days
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.33
  • Average comments per pull request: 0.2
  • Merged pull requests: 40
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 17
  • Average time to close issues: about 7 hours
  • Average time to close pull requests: 1 day
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 15
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ClaasRostock (8)
  • flakstad (1)
Pull Request Authors
  • ClaasRostock (56)
  • frl000 (6)
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Dependencies

requirements.txt pypi
  • Pillow >=8.4.0
  • SALib >=1.4.5
  • Sphinx >=4.3.0
  • dictIO >=0.1.1
  • flake8 >=4.0.1
  • furo *
  • lxml >=4.6.4
  • myst-parser >=0.15.2
  • numpy >=1.21.4
  • ospx >=0.1.2
  • pep8-naming >=0.12.1
  • psutil >=5.8.0
  • pyDOE >=0.3.8
  • pytest >=6.2.5
  • pytest-cov >=3.0.0
  • pytest-randomly >=3.11.0
  • scipy >=1.7.3
  • sobol-seq >=0.2.0
  • sphinx-argparse-cli >=1.8.2
  • yapf >=0.31.0
requirements-dev.txt pypi
  • Sphinx >=5.3 development
  • black >=23.1.0 development
  • furo >=2022.9.29 development
  • myst-parser >=0.18 development
  • pyright >=1.1.292 development
  • pytest >=7.2 development
  • pytest-cov >=4.0 development
  • pytest-randomly >=3.12 development
  • ruff >=0.0.240 development
  • sourcery >=1.0.3 development
  • sourcery-cli >=1.0.3 development
  • sphinx-argparse-cli >=1.10 development
.github/workflows/_build_and_publish_documentation.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • ammaraskar/sphinx-problem-matcher master composite
  • peaceiris/actions-gh-pages v3 composite
.github/workflows/_build_and_publish_documentation.yml.original_single_repo_version.disabled actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • ammaraskar/sphinx-problem-matcher master composite
  • peaceiris/actions-gh-pages v3 composite
.github/workflows/_build_package.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • actions/upload-artifact v3 composite
.github/workflows/_code_quality.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • psf/black stable composite
.github/workflows/_merge_into_release.yml actions
  • actions/checkout v3 composite
  • devmasx/merge-branch v1.4.0 composite
.github/workflows/_publish_package.yml actions
  • actions/download-artifact v3 composite
  • pypa/gh-action-pypi-publish v1.5.2 composite
.github/workflows/_test.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/_test_future.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
.github/workflows/nightly_build.yml actions
.github/workflows/publish_release.yml actions
.github/workflows/pull_request_to_main.yml actions
.github/workflows/push.yml actions
.github/workflows/push_to_main.yml actions
.github/workflows/push_to_release.yml actions
pyproject.toml pypi
requirements-types.txt pypi
  • types-lxml >=2023.3.28