Packages
chi2fit_nb
0.1.0
Provides functions for fast matrix inversion, creation of empirical CDF from sample data including handling of asymmetric errors, and fitting to a funtion using chi-squared. The fitting procedure return the full covariance matrix describing the fitted parameters.
Current section
Files
Jump to
Current section
Files
chi2fit_nb
mix.exs
mix.exs
defmodule Chi2fitNb.MixProject do
# Copyright 2015-2026 Pieter Rijken
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use Mix.Project
@version "0.1.0"
defp version(), do: @version
def project do
[
app: :chi2fit_nb,
version: version(),
elixir: ">= 1.14.0",
start_permanent: Mix.env == :prod,
deps: deps(),
aliases: aliases(),
compilers: (if Mix.env == :docs, do: [:md], else: []) ++ Mix.compilers,
## Hex stuff:
description: description(),
package: package(),
name: "Chi-SquaredFit Notebook",
source_url: "https://github.com/piisgaaf/chi2fit_nb",
## Docs
docs: docs()
]
end
# Run "mix help compile.app" to learn about applications.
def application() do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps() do
[
{:chi2fit, "~> 2.1"},
{:graphvix,"~> 1.1"},
{:stream_data, "~> 1.2"},
{:gnuplot, "~> 1.19.104"},
{:poison, "~> 3.0", only: [:test]},
{:ex_doc, "~> 0.40"},
]
end
defp aliases() do
[
test_notebook: ["test --only notebooks"],
docsproject: ["docs", ©_images/1],
"docker.build": ["cmd docker buildx build -f docker/Dockerfile -t chi2fitnb:v#{version()} ."],
"docker.run": ["cmd docker run -dp 8888:8888 --hostname localhost -e JUPYTER_TOKEN=mysecret chi2fitnb:v#{version()}"]
]
end
# Hex Package Manager stuff:
defp description() do
"""
Provides functions for fast matrix inversion, creation of empirical CDF from sample data including
handling of asymmetric errors, and fitting to a funtion using chi-squared. The fitting procedure return
the full covariance matrix describing the fitted parameters.
"""
end
defp package() do
[
maintainers: [ "Pieter Rijken" ],
licenses: [ "Apache-2.0" ],
files: [ "lib", "mix.exs", "README*", "LICENSE*", "NOTICE", "config" ],
links: %{
"GitHub" => "https://github.com/piisgaaf/chi2fit_nb",
}
]
end
def cli() do
[
preferred_envs: [
test_notebook: :test,
"coveralls.html": :test,
"hex.publish": :docs
]
]
end
defp docs() do
[
extras: extras()
]
end
def extras(), do: [
"README.md",
"Analysis-cycle-time-data.md",
"Analysis-throughput-data.md",
"Forecasting-empirical-data.md",
"Forecasting-fit-to-known-distribution.md",
"Forecasting-bootstrapping.md",
"Forecasting-non-equilibrium.md",
"Forecasting-cycle-times.md",
"Example-multi-plot.md",
"Example-multi-modal.md",
"Guide-parameter-fitting-3d.md"
] |> Enum.map(& "#{Mix.Project.build_path()}/lib/chi2fit/docs/"<>&1)
defp copy_images(_args) do
"#{Mix.Project.build_path()}/lib/chi2fit/docs/*_files"
|> Path.wildcard()
|> Enum.each(& File.cp_r!(&1, "doc/#{Path.basename &1}"))
end
end
defmodule Mix.Tasks.Compile.Md do
use Mix.Task.Compiler
@shortdoc "Compiles with jupyter nbconvert to create markdown from a notebook"
def run(_) do
outdir = "#{Mix.Project.build_path()}/lib/chi2fit/docs"
docs = Chi2fitNb.MixProject.extras()
{result, _error_code} = System.cmd("make", docs, stderr_to_stdout: true, env: [{"OUTDIR",outdir}])
Mix.shell.info result
end
end