diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 7825cfe..7e0b5fa 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -2,48 +2,48 @@ name: CompatHelper on: - schedule: - - cron: 0 0 * * * - workflow_dispatch: + schedule: + - cron: 0 0 * * * + workflow_dispatch: permissions: - contents: write - pull-requests: write + contents: write + pull-requests: write jobs: - CompatHelper: - runs-on: ubuntu-latest - steps: - - name: Check if Julia is already available in the PATH - id: julia_in_path - run: which julia - continue-on-error: true - - name: Install Julia, but only if it is not already available in the PATH - uses: julia-actions/setup-julia@v1 - with: - version: "1" - arch: ${{ runner.arch }} - if: steps.julia_in_path.outcome != 'success' - - name: "Add the General registry via Git" - run: | - import Pkg - ENV["JULIA_PKG_SERVER"] = "" - Pkg.Registry.add("General") - shell: julia --color=yes {0} - - name: "Install CompatHelper" - run: | - import Pkg - name = "CompatHelper" - uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" - version = "3" - Pkg.add(; name, uuid, version) - shell: julia --color=yes {0} - - name: "Run CompatHelper" - run: | - import CompatHelper - CompatHelper.main() - shell: julia --color=yes {0} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} - # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Check if Julia is already available in the PATH + id: julia_in_path + run: which julia + continue-on-error: true + - name: Install Julia, but only if it is not already available in the PATH + uses: julia-actions/setup-julia@v1 + with: + version: "1" + arch: ${{ runner.arch }} + if: steps.julia_in_path.outcome != 'success' + - name: "Add the General registry via Git" + run: | + import Pkg + ENV["JULIA_PKG_SERVER"] = "" + Pkg.Registry.add("General") + shell: julia --color=yes {0} + - name: "Install CompatHelper" + run: | + import Pkg + name = "CompatHelper" + uuid = "aa819f21-2bde-4658-8897-bab36330d9b7" + version = "3" + Pkg.add(; name, uuid, version) + shell: julia --color=yes {0} + - name: "Run CompatHelper" + run: | + import CompatHelper + CompatHelper.main() + shell: julia --color=yes {0} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + # COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }} diff --git a/.github/workflows/Copier.yml b/.github/workflows/Copier.yml index 2ecd879..a894016 100644 --- a/.github/workflows/Copier.yml +++ b/.github/workflows/Copier.yml @@ -1,52 +1,52 @@ name: Copier Update on: - schedule: - - cron: 0 7 1/7 * * - workflow_dispatch: + schedule: + - cron: 0 7 1/7 * * + workflow_dispatch: jobs: - Copier: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - token: ${{ secrets.COPIER_PAT }} - - uses: julia-actions/setup-julia@v1 - with: - version: "1" - - name: Use Julia cache - uses: julia-actions/cache@v1 - - name: Install JuliaFormatter.jl - run: julia -e 'using Pkg; pkg"add JuliaFormatter"' - - name: Setup Python - uses: actions/setup-python@v4 - - name: Check for update in the template - run: | - pip install copier - copier update -A -o rej - echo -e "Automated changed by Copier.yml workflow\n" > /tmp/body.md - echo -e 'Rejected changes (if any):\n```diff\n' >> /tmp/body.md - find . -name "*.rej" | xargs cat >> /tmp/body.md - find . -name "*.rej" | xargs rm -f - echo -e '```' >> /tmp/body.md - git diff - - name: Run pre-commit to run the formatters - run: | - pip install pre-commit - pre-commit run -a || true # Ignore pre-commit errors - - name: Create Pull Request - id: cpr - uses: peter-evans/create-pull-request@v5 - with: - token: ${{ secrets.COPIER_PAT }} - commit-message: ":robot: COPIERTemplate.jl update" - title: "[AUTO] COPIERTemplate.jl update" - body-path: /tmp/body.md - branch: auto-copier-template-update - delete-branch: true - labels: configuration, automated pr, no changelog - - name: Check outputs - run: | - echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" + Copier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + token: ${{ secrets.COPIER_PAT }} + - uses: julia-actions/setup-julia@v1 + with: + version: "1" + - name: Use Julia cache + uses: julia-actions/cache@v1 + - name: Install JuliaFormatter.jl + run: julia -e 'using Pkg; pkg"add JuliaFormatter"' + - name: Setup Python + uses: actions/setup-python@v4 + - name: Check for update in the template + run: | + pip install copier + copier update -A -o rej + echo -e "Automated changed by Copier.yml workflow\n" > /tmp/body.md + echo -e 'Rejected changes (if any):\n```diff\n' >> /tmp/body.md + find . -name "*.rej" | xargs cat >> /tmp/body.md + find . -name "*.rej" | xargs rm -f + echo -e '```' >> /tmp/body.md + git diff + - name: Run pre-commit to run the formatters + run: | + pip install pre-commit + pre-commit run -a || true # Ignore pre-commit errors + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.COPIER_PAT }} + commit-message: ":robot: COPIERTemplate.jl update" + title: "[AUTO] COPIERTemplate.jl update" + body-path: /tmp/body.md + branch: auto-copier-template-update + delete-branch: true + labels: configuration, automated pr, no changelog + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.github/workflows/Docs.yml b/.github/workflows/Docs.yml index 4f5b6bc..5c3403f 100644 --- a/.github/workflows/Docs.yml +++ b/.github/workflows/Docs.yml @@ -1,51 +1,51 @@ name: Docs on: - push: - branches: - - main - paths: - - "docs/**" - - "src/**" - - "*.toml" - tags: ["*"] - pull_request: - branches: - - main - paths: - - "docs/**" - - "src/**" - - "*.toml" - types: [opened, synchronize, reopened] + push: + branches: + - main + paths: + - "docs/**" + - "src/**" + - "*.toml" + tags: ["*"] + pull_request: + branches: + - main + paths: + - "docs/**" + - "src/**" + - "*.toml" + types: [opened, synchronize, reopened] concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: - docs: - name: Documentation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@v1 - with: - version: "1" - - run: | - julia --project=docs -e ' - using Pkg - Pkg.develop(PackageSpec(path=pwd())) - Pkg.instantiate()' - - run: | - julia --project=docs -e ' - using Documenter: DocMeta, doctest - using TulipaProfileFitting - DocMeta.setdocmeta!(TulipaProfileFitting, :DocTestSetup, :(using TulipaProfileFitting); recursive=true) - doctest(TulipaProfileFitting)' - - run: julia --project=docs docs/make.jl - env: - JULIA_PKG_SERVER: "" - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: julia-actions/setup-julia@v1 + with: + version: "1" + - run: | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate()' + - run: | + julia --project=docs -e ' + using Documenter: DocMeta, doctest + using TulipaProfileFitting + DocMeta.setdocmeta!(TulipaProfileFitting, :DocTestSetup, :(using TulipaProfileFitting); recursive=true) + doctest(TulipaProfileFitting)' + - run: julia --project=docs docs/make.jl + env: + JULIA_PKG_SERVER: "" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/Lint.yml b/.github/workflows/Lint.yml index 6af09a2..e918e90 100644 --- a/.github/workflows/Lint.yml +++ b/.github/workflows/Lint.yml @@ -1,37 +1,37 @@ name: Lint on: - push: - branches: - - main - tags: ["*"] - pull_request: + push: + branches: + - main + tags: ["*"] + pull_request: concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} permissions: contents: read jobs: - lint: - name: Linting - runs-on: ubuntu-latest - steps: - - name: Clone - uses: actions/checkout@v3 - - name: Setup Julia - uses: julia-actions/setup-julia@v1 - with: - version: "1" - - name: Use Julia cache - uses: julia-actions/cache@v1 - - name: Install JuliaFormatter.jl - run: julia -e 'using Pkg; pkg"add JuliaFormatter"' - - name: Setup Python - uses: actions/setup-python@v4 - - name: Install pre-commit - run: pip install pre-commit - - name: Run pre-commit - run: SKIP=no-commit-to-branch pre-commit run -a + lint: + name: Linting + runs-on: ubuntu-latest + steps: + - name: Clone + uses: actions/checkout@v3 + - name: Setup Julia + uses: julia-actions/setup-julia@v1 + with: + version: "1" + - name: Use Julia cache + uses: julia-actions/cache@v1 + - name: Install JuliaFormatter.jl + run: julia -e 'using Pkg; pkg"add JuliaFormatter"' + - name: Setup Python + uses: actions/setup-python@v4 + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit + run: SKIP=no-commit-to-branch pre-commit run -a diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index 66ec3ff..2b2439f 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -1,36 +1,35 @@ name: TagBot on: - issue_comment: - types: - - created - workflow_dispatch: - inputs: - lookback: - type: number - default: 3 + issue_comment: + types: + - created + workflow_dispatch: + inputs: + lookback: + type: number + default: 3 permissions: - actions: read - checks: read - contents: write - deployments: read - issues: read - discussions: read - packages: read - pages: read - pull-requests: read - repository-projects: read - security-events: read - statuses: read + actions: read + checks: read + contents: write + deployments: read + issues: read + discussions: read + packages: read + pages: read + pull-requests: read + repository-projects: read + security-events: read + statuses: read jobs: - TagBot: - if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' - runs-on: ubuntu-latest - steps: - - uses: JuliaRegistries/TagBot@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - ssh: ${{ secrets.DOCUMENTER_KEY }} - + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml index 754bc04..bd4cf0d 100644 --- a/.github/workflows/Test.yml +++ b/.github/workflows/Test.yml @@ -1,79 +1,79 @@ name: Test on: - push: - branches: - - main - paths: - - "src/**" - - "test/**" - - "*.toml" - tags: ["*"] - pull_request: - branches: - - main - paths: - - "src/**" - - "test/**" - - "*.toml" - types: [opened, synchronize, reopened] + push: + branches: + - main + paths: + - "src/**" + - "test/**" + - "*.toml" + tags: ["*"] + pull_request: + branches: + - main + paths: + - "src/**" + - "test/**" + - "*.toml" + types: [opened, synchronize, reopened] concurrency: - # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} jobs: - test: - name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - version: - - "1.6" - - "1" - - "nightly" - os: - - ubuntu-latest - - macOS-latest - #- windows-latest - arch: - - x64 - allow_failure: [false] - include: - - version: "nightly" - os: ubuntu-latest - arch: x64 - allow_failure: true - - version: "nightly" - os: macOS-latest - arch: x64 - allow_failure: true - #- version: "nightly" - # os: windows-latest - # arch: x64 - # allow_failure: true - steps: - - uses: actions/checkout@v3 - - uses: julia-actions/setup-julia@v1 - with: - version: ${{ matrix.version }} - arch: ${{ matrix.arch }} - - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 - - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 - with: - file: lcov.info + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - "1.6" + - "1" + - "nightly" + os: + - ubuntu-latest + - macOS-latest + #- windows-latest + arch: + - x64 + allow_failure: [false] + include: + - version: "nightly" + os: ubuntu-latest + arch: x64 + allow_failure: true + - version: "nightly" + os: macOS-latest + arch: x64 + allow_failure: true + #- version: "nightly" + # os: windows-latest + # arch: x64 + # allow_failure: true + steps: + - uses: actions/checkout@v3 + - uses: julia-actions/setup-julia@v1 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - uses: actions/cache@v1 + env: + cache-name: cache-artifacts + with: + path: ~/.julia/artifacts + key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} + restore-keys: | + ${{ runner.os }}-test-${{ env.cache-name }}- + ${{ runner.os }}-test- + ${{ runner.os }}- + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v1 + with: + file: lcov.info diff --git a/.markdown-link-config.json b/.markdown-link-config.json index de14e9e..2b974ba 100644 --- a/.markdown-link-config.json +++ b/.markdown-link-config.json @@ -1,7 +1,7 @@ { - "ignorePatterns": [ - { - "pattern": "@ref" - } - ] + "ignorePatterns": [ + { + "pattern": "@ref" + } + ] } diff --git a/.markdownlint.json b/.markdownlint.json index 8bf958a..2473a70 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -1,13 +1,13 @@ { - "MD007": { - "indent": 2, - "start_indented": false - }, - "MD013": { - "line_length": 1000, - "tables": false - }, - "MD033": false, - "MD041": false, - "default": true + "MD007": { + "indent": 2, + "start_indented": false + }, + "MD013": { + "line_length": 1000, + "tables": false + }, + "MD033": false, + "MD041": false, + "default": true } diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 49f1c39..03eed8a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,55 +1,55 @@ repos: - - repo: local - hooks: - # Prevent committing .rej files - - id: forbidden-files - name: forbidden files - entry: found Copier update rejection files; review them and remove them - language: fail - files: "\\.rej$" - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: - - id: check-json - - id: check-toml - - id: check-yaml - - id: end-of-file-fixer - - id: file-contents-sorter - files: .JuliaFormatter.toml - args: [--unique] - - id: mixed-line-ending - args: [--fix=lf] - - id: no-commit-to-branch - - id: pretty-format-json - args: [--autofix, --indent=2] - - id: trailing-whitespace - - id: check-merge-conflict - args: [--assume-in-merge] - - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.37.0 - hooks: - - id: markdownlint-fix - - repo: https://github.com/citation-file-format/cffconvert - rev: 054bda51dbe278b3e86f27c890e3f3ac877d616c - hooks: - - id: validate-cff - - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.3" # Use the sha or tag you want to point at - hooks: - - id: prettier - types_or: [yaml, json] - exclude: ".copier-answers.yml" - - repo: https://github.com/adrienverge/yamllint - rev: v1.32.0 - hooks: - - id: yamllint - - repo: https://github.com/domluna/JuliaFormatter.jl - rev: v1.0.36 - hooks: - - id: julia-formatter - - repo: https://github.com/tcort/markdown-link-check - rev: v3.11.2 - hooks: - - id: markdown-link-check - args: - - --config=.markdown-link-config.json + - repo: local + hooks: + # Prevent committing .rej files + - id: forbidden-files + name: forbidden files + entry: found Copier update rejection files; review them and remove them + language: fail + files: "\\.rej$" + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-json + - id: check-toml + - id: check-yaml + - id: end-of-file-fixer + - id: file-contents-sorter + files: .JuliaFormatter.toml + args: [--unique] + - id: mixed-line-ending + args: [--fix=lf] + - id: no-commit-to-branch + - id: pretty-format-json + args: [--autofix, --indent=4] + - id: trailing-whitespace + - id: check-merge-conflict + args: [--assume-in-merge] + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.37.0 + hooks: + - id: markdownlint-fix + - repo: https://github.com/citation-file-format/cffconvert + rev: 054bda51dbe278b3e86f27c890e3f3ac877d616c + hooks: + - id: validate-cff + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v3.0.3" # Use the sha or tag you want to point at + hooks: + - id: prettier + types_or: [yaml, json] + exclude: ".copier-answers.yml" + - repo: https://github.com/adrienverge/yamllint + rev: v1.32.0 + hooks: + - id: yamllint + - repo: https://github.com/domluna/JuliaFormatter.jl + rev: v1.0.36 + hooks: + - id: julia-formatter + - repo: https://github.com/tcort/markdown-link-check + rev: v3.11.2 + hooks: + - id: markdown-link-check + args: + - --config=.markdown-link-config.json diff --git a/.yamllint.yml b/.yamllint.yml index cf2d252..ffeab4b 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -1,2 +1,2 @@ rules: - indentation: { spaces: 4 } + indentation: { spaces: 4 } diff --git a/docs/make.jl b/docs/make.jl index 2fb7b0d..b06c347 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,27 +1,32 @@ using TulipaProfileFitting using Documenter -DocMeta.setdocmeta!(TulipaProfileFitting, :DocTestSetup, :(using TulipaProfileFitting); recursive = true) +DocMeta.setdocmeta!( + TulipaProfileFitting, + :DocTestSetup, + :(using TulipaProfileFitting); + recursive = true, +) makedocs(; - modules = [TulipaProfileFitting], - doctest = true, - linkcheck = true, - authors = "TNO and contributors", - repo = "https://github.com/TulipaEnergy/TulipaProfileFitting.jl/blob/{commit}{path}#{line}", - sitename = "TulipaProfileFitting.jl", - format = Documenter.HTML(; - prettyurls = get(ENV, "CI", "false") == "true", - canonical = "https://TulipaEnergy.github.io/TulipaProfileFitting.jl", - assets = ["assets/style.css"], - ), - pages = [ - "Home" => "index.md", - "Mathematical Formulation" => "formulation.md", - "Contributing" => "contributing.md", - "Dev setup" => "developer.md", - "Reference" => "reference.md", - ], + modules = [TulipaProfileFitting], + doctest = true, + linkcheck = true, + authors = "TNO and contributors", + repo = "https://github.com/TulipaEnergy/TulipaProfileFitting.jl/blob/{commit}{path}#{line}", + sitename = "TulipaProfileFitting.jl", + format = Documenter.HTML(; + prettyurls = get(ENV, "CI", "false") == "true", + canonical = "https://TulipaEnergy.github.io/TulipaProfileFitting.jl", + assets = ["assets/style.css"], + ), + pages = [ + "Home" => "index.md", + "Mathematical Formulation" => "formulation.md", + "Contributing" => "contributing.md", + "Dev setup" => "developer.md", + "Reference" => "reference.md", + ], ) deploydocs(; repo = "github.com/TulipaEnergy/TulipaProfileFitting.jl", push_preview = true) diff --git a/src/model.jl b/src/model.jl index 9fe8d5d..8c2d391 100644 --- a/src/model.jl +++ b/src/model.jl @@ -8,9 +8,7 @@ This function takes a vector of profile values and the total hours in the year. It fits the profile values to the mean value of the profile and the total hours in the year. It returns the optimization model and the coefficient of the scaling. """ -function fit_profile(profile_values::Vector{Float64}, - target_mean::Float64) - +function fit_profile(profile_values::Vector{Float64}, target_mean::Float64) total_hours = length(profile_values) # Create a model @@ -20,7 +18,11 @@ function fit_profile(profile_values::Vector{Float64}, @variable(model, x >= 0) # Create the objective function - @NLobjective(model, Min, (sum((profile_values[i])^x for i in 1:total_hours) - target_mean*total_hours)^2) + @NLobjective( + model, + Min, + (sum((profile_values[i])^x for i = 1:total_hours) - target_mean * total_hours)^2 + ) # Solve the model optimize!(model) @@ -30,6 +32,4 @@ function fit_profile(profile_values::Vector{Float64}, # Return the coefficient return coefficient - end - diff --git a/test/runtests.jl b/test/runtests.jl index c2fbd4a..56a2dfa 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -2,8 +2,8 @@ using TulipaProfileFitting using Test @testset "TulipaProfileFitting.jl" begin - profile_values = [0.2,0.5,0.9,1.0,0.4,0.1,0.0] + profile_values = [0.2, 0.5, 0.9, 1.0, 0.4, 0.1, 0.0] target_mean = 0.5 coefficient = fit_profile(profile_values, target_mean) - @test coefficient ≈ 0.7491921789832345 atol=0.01 + @test coefficient ≈ 0.7491921789832345 atol = 0.01 end