Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into update.main
Browse files Browse the repository at this point in the history
  • Loading branch information
aoymt committed Oct 31, 2024
2 parents 7bfd3c9 + 0a0b7a6 commit 0db5975
Show file tree
Hide file tree
Showing 45 changed files with 1,871 additions and 240 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ on: [push]

jobs:
check-build-doc:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: main

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Prepare LaTeX env
run: |
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@ name: upload docs to gh-pages
on:
push:
branches:
- master
- develop
- ghactions
- '*-autodoc'
- main
# - develop
# - ghactions
# - '*-autodoc'
- '!gh-pages'
tags: ['*']
# tags: ['*']

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: main

- name: Checkout gh-pages
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Prepare LaTeX env
run: |
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Push
env:
GIT_USER: "2DMAT Developers"
GIT_USER: "ODAT-SE Developers"
GIT_EMAIL: "[email protected]"
TARGET_NAME: ${{ env.GITHUB_REF_SLUG }}
run: |
Expand All @@ -76,7 +76,7 @@ jobs:
mkdir -p "gh-pages/manual/${TARGET_NAME}"
cp -r "main/doc/${lang}/build/html" "gh-pages/manual/${TARGET_NAME}/${lang}"
if [ $is_tag = "YES" ]; then
# cp "main/doc/${lang}/build/latex/userguid_2dmat_${lang}.pdf" "gh-pages/manual/${TARGET_NAME}/${lang}/2DMAT.pdf"
# cp "main/doc/${lang}/build/latex/userguid_odatse_${lang}.pdf" "gh-pages/manual/${TARGET_NAME}/${lang}/ODAT-SE.pdf"
:
fi
done
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/deploy_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@ name: upload package to PyPI

on:
push:
tags: ['*']
# tags: ['*']
tags: ['disabled-because-odatse-is-not-yet-ready-in-pypi']

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.11

- name: Install python packages
run: |
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
name: Test

on: [push]
on: [push, pull_request]

jobs:
main:
runs-on: ubuntu-20.04
timeout-minutes: 10
strategy:
matrix:
python-version: [3.6, 3.9]
# os: ['ubuntu-22.04']
python-version: ['3.9', '3.12']
sample: [mapper, minsearch, exchange, exchange_mesh, pamc, bayes, transform]
fail-fast: false

name: ${{ matrix.sample }} with Python ${{ matrix.python-version }}
runs-on: 'ubuntu-22.04'
# runs-on: ${{ matrix.os }}
timeout-minutes: 10

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -34,7 +38,7 @@ jobs:
python -m pip install numpy scipy tomli mpi4py
python -m pip install physbo
- name: ${{ matrix.algorithm }}
- name: ${{ matrix.sample }}
run: |
cd ${GITHUB_WORKSPACE}/tests/${{ matrix.sample }}
sh ./do.sh
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ In the future, we plan to add other direct problem solvers and search algorithms

| Branch | Build status | Documentation |
| :----: | :-----------------------------------------: | :---------------------------------------------------------------------------------------: |
| [master][source/master] (latest, stable) | [![master][ci/master/badge]][ci/master/uri] | [![doc_en][doc/en/badge]][doc/master/en/uri] [![doc_ja][doc/ja/badge]][doc/master/ja/uri] |
| [develop][source/develop] (latest, unstable) | -- | [![doc_en][doc/en/badge]][doc/develop/en/uri] [![doc_ja][doc/ja/badge]][doc/develop/ja/uri] |
| [main][source/main] (latest, stable) | [![main][ci/main/badge]][ci/main/uri] | [![doc_en][doc/en/badge]][doc/main/en/uri] [![doc_ja][doc/ja/badge]][doc/main/ja/uri] |
<!-- | [develop][source/develop] (latest, unstable) | -- | [![doc_en][doc/en/badge]][doc/develop/en/uri] [![doc_ja][doc/ja/badge]][doc/develop/ja/uri] | -->

## odat-se

Expand All @@ -24,7 +24,7 @@ It also offers a driver script to solve the problem with predefined optimization
### Prerequists

- Required
- python >= 3.6.8
- python >= 3.9
- numpy >= 1.14
- tomli >= 1.2.0
- Optional
Expand Down Expand Up @@ -98,13 +98,13 @@ Bibtex:
© *2020- The University of Tokyo. All rights reserved.*
This software was developed with the support of "*Project for advancement of software usability in materials science*" of The Institute for Solid State Physics, The University of Tokyo.

[source/master]: https://github.com/issp-center-dev/ODAT-SE/
[source/main]: https://github.com/issp-center-dev/ODAT-SE/
[source/develop]: https://github.com/issp-center-dev/ODAT-SE/tree/develop
[ci/master/badge]: https://github.com/issp-center-dev/ODAT-SE/workflows/Test/badge.svg?branch=master
[ci/master/uri]: https://github.com/issp-center-dev/ODAT-SE/actions?query=branch%3Amaster
[ci/main/badge]: https://github.com/issp-center-dev/ODAT-SE/workflows/Test/badge.svg?branch=main
[ci/main/uri]: https://github.com/issp-center-dev/ODAT-SE/actions?query=branch%3Amain
[doc/en/badge]: https://img.shields.io/badge/doc-English-blue.svg
[doc/ja/badge]: https://img.shields.io/badge/doc-Japanese-blue.svg
[doc/master/en/uri]: https://issp-center-dev.github.io/ODAT-SE/manual/master/en/index.html
[doc/master/ja/uri]: https://issp-center-dev.github.io/ODAT-SE/manual/master/ja/index.html
[doc/main/en/uri]: https://issp-center-dev.github.io/ODAT-SE/manual/main/en/index.html
[doc/main/ja/uri]: https://issp-center-dev.github.io/ODAT-SE/manual/main/ja/index.html
[doc/develop/en/uri]: https://issp-center-dev.github.io/ODAT-SE/manual/develop/en/index.html
[doc/develop/ja/uri]: https://issp-center-dev.github.io/ODAT-SE/manual/develop/ja/index.html
4 changes: 2 additions & 2 deletions doc/en/source/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Installation of ODAT-SE

Prerequisites
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Python3 (>=3.6.8)
- Python3 (>=3.9)

- The following Python packages are required.
- tomli >= 1.2
Expand All @@ -13,7 +13,7 @@ Prerequisites

- mpi4py (required for grid search)
- scipy (required for Nelder-Mead method)
- physbo (>=0.3, required for Baysian optimization)
- physbo (>=2.0, required for Baysian optimization)


How to download and install
Expand Down
2 changes: 1 addition & 1 deletion doc/ja/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ODAT-SEとは
----------------------

Open Data Analysis Tool for Science and Engineering (ODAT-SE)は、順問題ソルバーに対して探索アルゴリズムを適用して最適解を探すためのフレームワークです。これまで 2DMAT という名称で開発されてきましたが、Version 3 からは順問題ソルバーと探索アルゴリズムをモジュール化して汎用のデータ解析プラットフォームとして整備しています
Open Data Analysis Tool for Science and Engineering (ODAT-SE)は、順問題ソルバーに対して探索アルゴリズムを適用して最適解を探すためのフレームワークです。Version 2までは2DMATという名称で開発されてきましたが、Version 3からは順問題ソルバーと探索アルゴリズムをモジュール化した汎用のデータ解析プラットフォームとして整備しています

順問題ソルバーはユーザー自身で定義することが可能です。
標準的な順問題ソルバーとしては2次元物質構造解析向け実験データ解析ソフトウェアが用意されています。
Expand Down
4 changes: 2 additions & 2 deletions doc/ja/source/start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ODAT-SE のインストール

実行環境・必要なパッケージ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- python 3.6.8 以上
- python 3.9 以上

- 必要なpythonパッケージ

Expand All @@ -14,7 +14,7 @@ ODAT-SE のインストール

- mpi4py (グリッド探索利用時)
- scipy (Nelder-Mead法利用時)
- physbo (ベイズ最適化利用時, ver. 0.3以上)
- physbo (ベイズ最適化利用時, ver. 2.0以上)

ダウンロード・インストール
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ packages = [
]

[tool.poetry.dependencies]
python = ">=3.6.8"
python = ">=3.9"
numpy = "^1.14"
tomli = ">=1.2"
scipy = {version = "^1", optional = true}
Expand All @@ -26,10 +26,6 @@ bayes = ["physbo"]
exchange = ["mpi4py"]
all = ["scipy", "mpi4py", "physbo"]

[tool.poetry.dev-dependencies]
black = "^22.3.0"
pynvim = "^0.4.3"

[tool.poetry.scripts]
odatse = "odatse:main"
odatse_neighborlist = "odatse.util.neighborlist:main"
Expand Down
50 changes: 50 additions & 0 deletions src/odatse/_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,43 @@


class Info:
"""
A class to represent the information structure for the data-analysis software.
"""

base: dict
algorithm: dict
solver: dict
runner: dict

def __init__(self, d: Optional[MutableMapping] = None):
"""
Initialize the Info object.
Parameters
----------
d : MutableMapping (optional)
A dictionary to initialize the Info object.
"""
if d is not None:
self.from_dict(d)
else:
self._cleanup()

def from_dict(self, d: MutableMapping) -> None:
"""
Initialize the Info object from a dictionary.
Parameters
----------
d : MutableMapping
A dictionary containing the information to initialize the Info object.
Raises
------
exception.InputError
If any required section is missing in the input dictionary.
"""
for section in ["base", "algorithm", "solver"]:
if section not in d:
raise exception.InputError(
Expand All @@ -58,6 +83,9 @@ def from_dict(self, d: MutableMapping) -> None:
)

def _cleanup(self) -> None:
"""
Reset the Info object to its default state.
"""
self.base = {}
self.base["root_dir"] = Path(".").absolute()
self.base["output_dir"] = self.base["root_dir"]
Expand All @@ -67,6 +95,28 @@ def _cleanup(self) -> None:

@classmethod
def from_file(cls, file_name, fmt="", **kwargs):
"""
Create an Info object from a file.
Parameters
----------
file_name : str
The name of the file to load the information from.
fmt : str
The format of the file (default is "").
**kwargs
Additional keyword arguments.
Returns
-------
Info
An Info object initialized with the data from the file.
Raises
------
ValueError
If the file format is unsupported.
"""
if fmt == "toml" or fnmatch(file_name.lower(), "*.toml"):
inp = {}
if mpi.rank() == 0:
Expand Down
7 changes: 7 additions & 0 deletions src/odatse/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
import odatse

def main():
"""
Main function to run the data-analysis software for quantum beam diffraction experiments
on 2D material structures. It parses command-line arguments, loads the input file,
selects the appropriate algorithm and solver, and executes the analysis.
"""

info, run_mode = odatse.initialize()

alg_module = odatse.algorithm.choose_algorithm(info.algorithm["name"])

solvername = info.solver["name"]
Expand Down
Loading

0 comments on commit 0db5975

Please sign in to comment.