Packages
chi2fit
1.1.0
3.1.0
3.0.1
3.0.0
2.1.7
2.1.6
2.1.5
retired
2.1.4
retired
2.1.3
retired
2.1.2
retired
2.1.1
retired
2.1.0
retired
2.0.2
2.0.1
2.0.0
1.3.0
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-beta.11
1.0.0-beta.10
1.0.0-beta.9
1.0.0-beta.8
1.0.0-beta.7
1.0.0-beta.6
1.0.0-beta.5
1.0.0-beta.4
1.0.0-beta.3
1.0.0-beta.2
1.0.0-beta.1
1.0.0-beta
1.0.0-alpha
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.11
0.8.10
0.8.9
0.8.8
0.8.7-alpha.2
0.8.7-alpha
0.8.6
0.8.5
0.8.4
0.8.3
0.8.2
0.8.1
0.8.0
0.7.8
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.3-1
0.7.2
0.7.1
0.7.0
0.6.7
0.6.6
0.6.5
0.6.3
0.6.0
0.5.2
0.5.1
0.5.0
0.4.0
0.3.1
0.3.0
0.2.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
lib/collector.ex
defmodule Chi2fit.Utilities.Collector do
use Agent
def start_link() do
Agent.start_link(fn -> [] end, name: __MODULE__)
end
defp capture(out \\ []) do
receive do
{:io_request, from, refid, {:put_chars, :unicode, data}} ->
send from, {:io_reply, refid, :ok}
capture [data|out]
{:stop,from} ->
send from, {:data, Enum.reverse(out)}
:ok
msg ->
raise ArgumentError, "[Collector] Received unexpected message: #{inspect msg}"
end
end
def collect, do: Agent.cast(__MODULE__, fn _ -> capture() end)
def value do
send __MODULE__, {:stop,self()}
receive do
{:data, data} -> Agent.update(__MODULE__, fn _ -> data end)
end
Agent.get(__MODULE__, fn acc -> acc end)
end
def stop, do: Agent.stop(__MODULE__)
end