text:
module LinearManifoldModels

import Distributions: estimate, partype, pdf, logpdf, _logpdf, _logpdf!, _pdf, _pdf!, _rand!,
                      sampler, Distribution, Estimator, ContinuousMultivariateDistribution,
                      Sampleable, Multivariate, Discrete, MixtureModel
import StatsBase: params, entropy, fit, Histogram, sturges, normalize
import KernelDensity
import LMCLUS

export NonparametricEstimator,
       EmpiricalLinearManifold,
       EmpiricalLinearManifoldSampler,
       estimate,
       params,
       partype,
       entropy,
       pdf,
       logpdf,
       fit

mutable struct NonparametricEstimator{D<:Distribution, T} <: Estimator{D} end
NonparametricEstimator(::Type{D}, ::Type{T}) where {D<:Distribution, T} = NonparametricEstimator{D, T}()
estimate(e::NonparametricEstimator{D, T}, args...; kvargs...) where {D<:Distribution, T} = fit(D, T, args...; kvargs...)

struct EmpiricalLinearManifold{T<:Real, E} <: ContinuousMultivariateDistribution
    μ::Vector{T}         # Translation vector matrix N x 1
    B::Matrix{T}         # Basis vectors matrix N x K
    estimate::Vector{E}  # K+1 - subspace dimensions + orthogonal subspace distance
end

### Basic properties
Base.show(io::IO, d::EmpiricalLinearManifold) =
    print(io, "EmpiricalLinearManifold{$(eltype(d.estimate))}(D=$(size(d.B,2)))")

Base.length(d::EmpiricalLinearManifold) = length(d.μ)
params(d::EmpiricalLinearManifold) = (d.μ, d.B)
@inline partype(d::EmpiricalLinearManifold{T, E}) where {T<:Real, E} = T

_logpdf(d::EmpiricalLinearManifold, x::AbstractVector) = log.(_pdf(d, x))
_logpdf!(r::AbstractArray, d::EmpiricalLinearManifold, X::AbstractMatrix) = log.(_pdf!(r, d, X))

struct EmpiricalLinearManifoldSampler{T<:Real, E} <: Sampleable{Multivariate,Discrete}
    μ::Vector{T}           # Translation vector matrix N x 1
    estimate::Vector{E}    # K+1 - subspace dimensions + orthogonal subspace distance
    ecdf::Matrix{T}
end
Base.length(s::EmpiricalLinearManifoldSampler) = length(s.μ)

_rand!(d::EmpiricalLinearManifold, x::AbstractVector) = _rand!(sampler(d), x)
function sampler(d::EmpiricalLinearManifold{T, E}) where {T<:Real, E}
    n = length(d.estimate)
    df = zeros(T, n, n)
    EmpiricalLinearManifoldSampler{T, E}(d.μ, d.estimate, df)
end

include("hist.jl")
include("kde.jl")

end # module


text:
using Coverage
# process '*.cov' files
coverage = process_folder() # defaults to src/; alternatively, supply the folder name as argument
# process '*.info' files
coverage = merge_coverage_counts(coverage, filter!(
    let prefixes = (joinpath(pwd(), "src", ""))
        c -> any(p -> startswith(c.filename, p), prefixes)
    end,
    LCOV.readfolder("test")))
# Get total coverage for all Julia files
covered_lines, total_lines = get_summary(coverage)
percent_coverage = round((covered_lines / total_lines) * 100, digits = 3)
println("total_coverage = $(percent_coverage)")
# Or process a single file
# @show get_summary(process_file(joinpath("src", "Mycelia.jl")))

ext: jl

max_stars_repo_name: snystrom/Mycelia

max_issues_repo_name: snystrom/Mycelia

max_forks_repo_name: cjprybol/Eisenia


text:
"""
TreeParzen.MLJTreeParzen

Submodule containing TreeParzen.jl interface overrides for MLJTuning.jl

Objects:
- `MLJTreeParzenSpace`
- `MLJTreeParzenTuning`

MLJTuning methods overridden for `MLJTreeParzenTuning` object:
- `default_n`
- `result`
- `models!`
- `setup`

Example usage:
```julia
# ] add MLJBase MLJModels MLJTuning DecisionTree

using MLJBase, MLJModels, MLJTuning, TreeParzen
X, y = @load_iris

@load DecisionTreeClassifier

space = (Dict(
    :min_purity_increase => HP.Uniform(:min_purity_increase, 0.0, 1.0),
    :merge_purity_threshold => HP.Uniform(:merge_purity_threshold, 0.0, 1.0),
    :pdf_smoothing => HP.Uniform(:pdf_smoothing, 0.0, 1.0),
))

dtc = DecisionTreeClassifier()

tm = TunedModel(
    model=dtc,
    ranges=space,
    tuning=MLJTreeParzen.MLJTreeParzenTuning(),
    n=250,
    resampling=CV(nfolds=3),
    measure=cross_entropy
)

mach = machine(tm, X, y)
fit!(mach)

best_model = fitted_params(mach).best_model
@show(best_model.min_purity_increase)
@show(best_model.merge_purity_threshold)
@show(best_model.pdf_smoothing)
```
"""
module MLJTreeParzen

export MLJTreeParzenTuning, MLJTreeParzenSpace

using DocStringExtensions

import MLJTuning

using ..API
using ..Configuration
import ..Graph
import ..Trials

######################################
# Custom data structures and methods #
######################################

"""
$(TYPEDEF)

Data structure to store the user selected search space plus any user-provided suggestions.
There are multiple constructors to support a variety of use cases.

$(TYPEDFIELDS)
"""
struct MLJTreeParzenSpace
    # deliberately not mutable, although bear in mind the underlying datatypes are ...
    """
    The user's space as a dictionary of parameter names and (potentially nested) `TreeParzen.HP.*` expressions
    """
    space::Dict{Symbol}
    """
    The set of fixed points suggested provided to search.
    The number of random warn-up rounds is reduced by the amount of suggestions provided
    """
    suggestions::Vector{Dict{Symbol}}

    # use an inner constructor to check now that checkspace returns nothing
    function MLJTreeParzenSpace(space, suggestions)
        Graph.checkspace(space)
        return new(space, suggestions)
    end

end

"""
$(TYPEDSIGNATURES)

Construct a hyperparameter search space from a `input_space` with keys as parameter names
and values as `TreeParzen.HP.*` tunable distributions (or composite expressions of these).

Example:
```julia
using TreeParzen

search = MLJTreeParzen.MLJTreeParzenSpace(
    Dict(
        :num_layers => HP.Choice(:num_layers, [2, 3, 4]),
        :num_nodes => HP.QuantUniform(:num_nodes, 20.0, 50.0, 1.0),
    )
);
```
"""
MLJTreeParzenSpace(input_space::Dict{Symbol}) = MLJTreeParzenSpace(input_space, Dict{Symbol}[])
"""
$(TYPEDSIGNATURES)

As above, but also accepting `suggestion` with parameter names and specific values to evaluate
the function to be tuned with.

The default constructor accepts a vector of suggestions.

Example (single suggestion):
```julia
using TreeParzen

search = MLJTreeParzen.MLJTreeParzenSpace(
    Dict(
        :num_layers => HP.Choice(:num_layers, [2, 3, 4]),
        :num_nodes => HP.QuantUniform(:num_nodes, 20.0, 50.0, 1.0),
    ),
    Dict(:num_layers => 3, :num_nodes => 40.0)
);
```

Example (multiple suggestions):
```julia
using TreeParzen

search = MLJTreeParzen.MLJTreeParzenSpace(
    Dict(
        :num_layers => HP.Choice(:num_layers, [2, 3, 4]),
        :num_nodes => HP.QuantUniform(:num_nodes, 20.0, 50.0, 1.0),
    ),
    [
        Dict(:num_layers => 3, :num_nodes => 40.0),
        Dict(:num_layers => 3, :num_nodes => 30.0),
    ]
);
```

"""
MLJTreeParzenSpace(input_space::Dict{Symbol}, suggestion::Dict{Symbol}) = MLJTreeParzenSpace(input_space, [suggestion])

"""

$(TYPEDEF)

The TreeParzen MLJ tuning object to be passed to MLJTuning APIs.

"""
struct MLJTreeParzenTuning <: MLJTuning.TuningStrategy
    config::Config
    max_simultaneous_draws::Int
end

"""
$(TYPEDSIGNATURES)

Keyword argument constructor
- `threshold::Float64`; default 0.25. This is the same as `TreeParzen.Config.gamma`
- `draws::Int`; default 24. This is the same as `TreeParzen.Config.draws`
- `linear_forgetting::Int`; default 25. This is the same as `TreeParzen.Config.linear_forgetting`
- `prior_weight::Float64`; default 1.0. This is the same as `TreeParzen.Config.prior_weight`
- `random_trials::Int`; default 20. This is the same as `TreeParzen.Config.random_trials`
- `max_simultaneous_draws::Int`; default 1. MLJ Interface specific, controls the number of
    candidate hyperparameters drawn without history updates during TreeParzen optimisation
    (not during suggestions/random sampling warmup), to enable MLJ parallel model training.
"""
function MLJTreeParzenTuning(;
    threshold::Float64 = 0.25,
    draws::Int = 24,
    linear_forgetting::Int = 25,
    prior_weight::Float64 = 1.0,
    random_trials::Int = 20,
    max_simultaneous_draws::Int = 1, # this only applies to TreeParzen draws, not suggestions or random
)

    config = Config(threshold, linear_forgetting, draws, random_trials, prior_weight)

    # hardcode simultaneous param to 1 for now
    return MLJTreeParzenTuning(config, max_simultaneous_draws)

end

################################################
# Start of MLJTuning interface implementations #
################################################

MLJTuning.default_n(tuning::MLJTreeParzenTuning, range) = 50

vector(history::Nothing) = Trials.Trial[]
vector(history::Vector) = history

get_trialhist(history) =
    map(history) do entry
        trial_object = entry.metadata
        sign = MLJTuning.signature(first(entry.measure))
        measurement = sign * first(entry.measurement)
        # @ablaom asks "Is this deepcopy really necessary?":
        completed_trial = deepcopy(trial_object)
        tell!(completed_trial, measurement)
        completed_trial
    end

function MLJTuning.models(
    strategy::MLJTreeParzenTuning,
    model,
    history,
    state,
    remaining,
    verbosity,
)

    space = state.space
    trialhist = state.trialhist

    num_hist = length(vector(history))

    # get an up-to-date the history of trial objects by appending to
    # the trial object history stored in `state`:
    recent_history =
        view(vector(history), (length(trialhist) + 1):num_hist)
    recent_trialhist = get_trialhist(recent_history)
    trialhist = vcat(state.trialhist, recent_trialhist)

    num_suggest = num_hist == 0 ? length(space.suggestions) : 0
    modeltype = typeof(model)
    max_draws = num_hist == 0 ? strategy.config.random_trials - num_suggest : strategy.max_simultaneous_draws

    # we could handle this but logic more complex and also it makes limited sense to permit anyway
    if max_draws < 0
        throw(ArgumentError("Number of suggestions cannot be more than number of warmup jobs: $num_suggest > $(strategy.config.random_trials)"))
    end

    candidates = Trials.Trial[]

    # we only ever do this when num_hist == 0
    for i in 1:num_suggest
        push!(candidates, ask(space.suggestions[i]))
    end

    # when num_hist == 0 this is the full number of random (independent draws) (minus suggestions as drawn above)
    # else its the max number of times we can ask TP from its distributions
    for i in 1:max_draws
        push!(candidates, ask(space.space, trialhist, strategy.config))
    end

    newstate = (space=space, trialhist=trialhist)
    vector_of_metamodels = [
        (modeltype(; candidate.hyperparams...), candidate)
        for candidate in candidates
    ]

    return vector_of_metamodels, newstate

end

# let the user construct the MLJTreeParzenSpace object directly or
# just specify a space dict, which will do the construction:
MLJTuning.setup(tuning::MLJTreeParzenTuning,
                model, range::Dict{Symbol},
                n, # ignored
                verbosity) =
                    (space=MLJTreeParzenSpace(range), trialhist=Trials.Trial[])
MLJTuning.setup(tuning::MLJTreeParzenTuning,
                model,
                space::MLJTreeParzenSpace,
                n, # ignored
                verbosity) =
                    (space=space, trialhist=Trials.Trial[])

end # module


text:
function mark_kross!(r)
    for s in (Nord, West, Sud, Ost)
        move_mark!(r, s)
        move_by_marks!(r, inverse_side(s))
    end
    putmarker!(r)
end

max_stars_repo_name: dmitrii-a-piskunov/mirea-progs

max_issues_repo_name: dmitrii-a-piskunov/mirea-progs

max_forks_repo_name: dmitrii-a-piskunov/mirea-progs


text:
using LearnConvection
using Plots

train = ["general_strat_8_profiles.jld2", "general_strat_16_profiles.jld2", "general_strat_32_profiles.jld2"]

default_modify_predictor_fn(x, 𝒟, time_index) = x

problems = [
            Slack("KPP"; parameters=KPP.Parameters(), modify_predictor_fn=f),
            Slack("TKE"; parameters=TKEMassFlux.TKEParameters(), modify_predictor_fn=f),
            Slack("KPP"; parameters=KPP.Parameters(), modify_predictor_fn=f),
            Slack("TKE"; parameters=TKEMassFlux.TKEParameters(), modify_predictor_fn=f),
]

D=64
N=4

k = 3
logγ = -0.1
distance = euclidean_distance
kernel = get_kernel(k, logγ, 0.0, distance)

ranges = [1:16, 17:32, 33:48, 49:64]

p = plot(xlabel="grid point", ylabel="abs(pred-truth)", title="Slack(TKE)")
for range in ranges
    f = partial_temp_profile(range)
    problem = Slack("TKE"; parameters=TKEMassFlux.TKEParameters(), modify_predictor_fn=partial_temp_profile(range))

    𝒟_train = LearnConvection.Data.data(train, problem; D=D, N=N);
    ℳ = LearnConvection.GaussianProcess.model(𝒟_train; kernel=kernel)

    a = disparity_vector(ℳ, 𝒟_train)
    plot!(a, label="$(range)", yscale=:log10)
end
p

png(p, "abs_logyscale_Slack_TKE_kernel_$(k)_gamma_$(logγ).png");

###

p = plot(xlabel="grid point", ylabel="(pred-truth)^2", title="Slack(TKE)")
for range in ranges
    f = partial_temp_profile(range)
    problem = Slack("TKE"; parameters=TKEMassFlux.TKEParameters(), modify_predictor_fn=partial_temp_profile(range))

    𝒟_train = LearnConvection.Data.data(train, problem; D=D, N=N);
    ℳ = LearnConvection.GaussianProcess.model(𝒟_train; kernel=kernel)

    a = disparity_vector(ℳ, 𝒟_train)
    plot!(a.^2, label="$(range)", yscale=:log10)
end
p

png(p, "squared_logyscale_Slack_TKE_kernel_$(k)_gamma_$(logγ).png");

max_stars_repo_name: adelinehillier/LearnConvection

max_issues_repo_name: adelinehillier/LearnConvection

max_forks_repo_name: adelinehillier/LearnConvection


text:
"""
    event_probability(startT, endT, events, background, kappa, kernel)
Forecast the probability of an event in defined time window.

# Arguments
* `startT::Number`: Left boundary of the forecasting window.
* `endT::Number`: Right boundary of the forecasting window.
* `events::Array{<:Number,1}`: Observed events
* `background`: Background rate
* `kappa::Float64`: Kappa value
* `kernel::Distribution`: Kernel distribution

# Notes
* As we are integregating the intensity function on a constant background, constant kappa and distriubtion for the kernel are supported.

"""

function event_probability(startT::Number, endT::Number, events::Array{<:Number}, background::Number, kappa::Number, kernel::Distribution)

    filter!(x-> x <= endT, events)
    background*(endT - startT) + kappa * sum( cdf.(kernel, endT .- events) .- cdf.(kernel, startT .- events) )

end


text:
using VariationalImaging.OpDenoise
using AlgTools.LinOps
using AlgTools.Util: @threadsif, dot

export tv_op_learning_function, denoise

Primal = Array{Float64,2}
Dual = Array{Float64,3}

###################
# Learning function
###################
function tv_op_learning_function(x,data,Δ;Δt=1e-6,kwargs...)
	ū = data[1]
	f = data[2]
    op = FwdGradientOp()
    u = denoise(f,x,op;kwargs...)
	#println(maximum(u-ū))
	cost = 0.5*norm₂²(u-ū)
	if Δ > Δt
    	grad = gradient(x,op,u,ū)
	else
		grad = gradient_reg(x,op,u,ū)
	end
    return u,cost,grad
end

###################
# Denoising
###################

const denoising_default_params = (
	ρ = 0,
	# PDPS
	τ₀ = 5,
	σ₀ = 0.99/5,
	accel = true,
	save_results = false,
	maxiter = 5000,
	verbose_iter = 5001,
	save_iterations = false
)

function denoise(data,x::Real,op::LinOp;kwargs...)
    denoise_scalar_params = (
        α = x,
		op = op
    )
	params = denoising_default_params ⬿ denoise_scalar_params ⬿ kwargs
    st_opt, iterate_opt = initialise_visualisation(false)
    opt_img = op_denoise_pdps(data; iterate=iterate_opt, params=params)
    finalise_visualisation(st_opt)
    return opt_img
end

function denoise(data,x::AbstractArray,op::LinOp)
	p = PatchOp(x,data[:,:,1]) # Adjust parameter size
	x̄ = zeros(p.size_out)
	inplace!(x̄,p,x)
    denoise_patch_params = (
        α = x̄,
		op = op
    )
	params = denoising_default_params ⬿ denoise_patch_params
    st_opt, iterate_opt = initialise_visualisation(false)
    opt_img = op_denoise_pdps(data; iterate=iterate_opt, params=params)
    finalise_visualisation(st_opt)
    return opt_img
end

function gradient(α::Real,op::LinOp,u::AbstractArray{T,3},ū::AbstractArray{T,3}) where T

	M,N,O = size(u)
	grad = 0
	for i = 1:O
		u1 = @view u[:,:,i]
		u2 = @view ū[:,:,i]
		g = gradient(α,op,u1,u2)
		grad += g
	end
	return grad
end

function gradient_reg(α::Real,op::LinOp,u::AbstractArray{T,3},ū::AbstractArray{T,3}) where T
	@info "Using reg gradient"
	M,N,O = size(u)
	grad = 0
	for i = 1:O
		u1 = @view u[:,:,i]
		u2 = @view ū[:,:,i]
		g = gradient_reg(α,op,u1,u2)
		grad += g
	end
	return grad
end

function gradient(α::Real, op::LinOp, u::AbstractArray{T,2}, ū::AbstractArray{T,2}) where T
	u = Float64.(Gray{Float64}.(u))
	ū = Float64.(Gray{Float64}.(ū))
	# Obtain Active and inactive sets
	n = size(u,1)

	# Generate centered gradient matrix
	#G = createDivMatrix(n)
	G = matrix(op,n)
	Gu = G*u[:]
	nGu = xi(Gu)
	act = nGu .< 1e-12
	inact = 1 .- act
	Act = spdiagm(0=>act)
	Inact = spdiagm(0=>inact)

	# Vector with grad norm in inactive components and one in the active
	den = Inact*nGu+act
	Den = spdiagm(0=>1 ./den)

	# prod KuKuᵗ/norm³
	prodKuKu = prodesc(Gu ./den.^3,Gu)

	Z1 = spzeros(2*n^2,2*n^2)
	Z2 = spzeros(n^2,2*n^2)
	# Adj = [spdiagm(0=>ones(n^2)) α*G';
	# 		Act*G+Inact*(prodKuKu-Den)*G Inact+eps()*Act]
	# Adj = [spdiagm(0=>ones(n^2)) -G';
	# 		Act*G+Inact*α*(Den-prodKuKu)*G Inact+sqrt(eps())*Act]+Inact*Den*Gu*G
	Adj = [spdiagm(0=>ones(n^2)) -G';
			Act*G+Inact*α*(Den-prodKuKu)*G Inact+eps()*Act]

	Track=[(u[:]-ū[:]);zeros(2*n^2)]
	mult = Adj\Track
	p = @view mult[1:n^2]
	grad = sum(scalarprod(G*p,Inact*Den*Gu))
	return -grad
end

function gradient_reg(α::Real,op::LinOp,u::AbstractArray{T,2}, ū::AbstractArray{T,2}) where T
	u = Float64.(Gray{Float64}.(u))
	ū = Float64.(Gray{Float64}.(ū))
	# Obtain Active and inactive sets
	n = size(u,1)
	γ = 1e8
	G = matrix(op,n)
	Gu = G*u[:]
	nGu = xi(Gu)
	act1 = nGu .- 1/γ
	act = max.(0,act1) .!= 0
	inact = 1 .- act
	Act = spdiagm(0=>act)
	Inact = spdiagm(0=>inact)
	den = Act*nGu + inact
	Den = spdiagm(0=>1 ./den)
	prodGuGu = prodesc(Gu./(den.^3),Gu)
	I = spdiagm(0=>ones(n^2))
	B = γ*Inact
	C = (Act*(prodGuGu-Den))
	p = (I+α*G'*(B-C)*G)\(ū[:]-u[:])
	grad = sum(scalarprod(G*p,Act*Den*Gu+γ*Inact*Gu))
	return grad

end

function gradient(α::AbstractArray, op::LinOp, u::AbstractArray{T,3}, ū::AbstractArray{T,3}) where T
	M,N,O = size(u)
	m,n = size(α)
	p = PatchOp(α,u[:,:,1]) # Adjust parameter size
	grad = zeros(size(α))
	for i = 1:O
		u1 = @view u[:,:,i]
		u2 = @view ū[:,:,i]
		g = gradient(p(α),op,p,u1,u2)
		grad .+= g
	end
	return grad
end

function gradient_reg(α::AbstractArray, op::LinOp, u::AbstractArray{T,3}, ū::AbstractArray{T,3}) where T
	@info "Using reg gradient"
	M,N,O = size(u)
	m,n = size(α)
	p = PatchOp(α,u[:,:,1]) # Adjust parameter size
	grad = zeros(size(α))
	for i = 1:O
		u1 = @view u[:,:,i]
		u2 = @view ū[:,:,i]
		g = gradient_reg(p(α),op,p,u1,u2)
		grad .+= g
	end
	return grad
end

function gradient_reg(α::AbstractArray,op::LinOp,pOp::PatchOp,u::AbstractArray{T,2}, ū::AbstractArray{T,2}) where T
	u = Float64.(Gray{Float64}.(u))
	ū = Float64.(Gray{Float64}.(ū))
	# Obtain Active and inactive sets
	m,n = size(u)
	γ = 1e8
	G = matrix(op,m)
	Gu = G*u[:]
	nGu = xi(Gu)
	act1 = nGu .- 1/γ
	act = max.(0,act1) .!= 0
	inact = 1 .- act
	Act = spdiagm(0=>act)
	Inact = spdiagm(0=>inact)
	den = Act*nGu + inact
	Den = spdiagm(0=>1 ./den)
	prodGuGu = prodesc(Gu./(den.^3),Gu)
	I = spdiagm(0=>ones(m*n))
	B = γ*Inact
	C = (Act*(prodGuGu-Den))
	p = (I+ α[:] .*G'*(B-C)*G)\(ū[:]-u[:])
	grad = reshape(spdiagm(0=>p)*(G'*(Act*Den*Gu+γ*Inact*Gu)),m,n)
	return calc_adjoint(pOp,grad)
end

function gradient(α::AbstractArray, op::LinOp, pOp::PatchOp, u::AbstractArray{T,2}, ū::AbstractArray{T,2}) where T
	u = Float64.(Gray{Float64}.(u))
	ū = Float64.(Gray{Float64}.(ū))
	# Obtain Active and inactive sets
	m,n = size(u)
	M,N = size(α)

	# Generate centered gradient matrix
	#G = createDivMatrix(n)
	G = matrix(op,n)
	Gu = G*u[:]
	nGu = xi(Gu)
	act = nGu .< 1e-12
	inact = 1 .- act
	Act = spdiagm(0=>act)
	Inact = spdiagm(0=>inact)

	# Vector with grad norm in inactive components and one in the active
	den = Inact*nGu+act
	Den = spdiagm(0=>1 ./den)

	# prod KuKuᵗ/norm³
	prodKuKu = prodesc(Gu ./den.^3,Gu)
	# Adj = [spdiagm(0=>ones(n^2)) spdiagm(0=>α[:])*G';
	# 		Act*G+Inact*(prodKuKu-Den)*G Inact+eps()*Act]
	Adj = [spdiagm(0=>ones(n^2)) -G';
			Act*G+Inact*spdiagm(0=>[α[:];α[:]])*(Den-prodKuKu)*G Inact+sqrt(eps())*Act]

	Track=[(u[:]-ū[:]);zeros(2*n^2)]
	mult = Adj\Track
	p = @view mult[1:n^2]
	grad = -scalarprod(G*p,Inact*Den*Gu)
	#grad = -spdiagm(0=>p[:])*(G'*Inact*Den*Gu)
	grad = reshape(grad,m,n)
	return calc_adjoint(pOp,grad)
end

max_stars_repo_name: dvillacis/BPLDenoising

max_issues_repo_name: dvillacis/BPLDenoising

max_forks_repo_name: dvillacis/BPLDenoising


text:
# --------------------------------------------------------------------------
# ACE1.jl: Julia implementation of the Atomic Cluster Expansion
# Copyright (c) 2019 Christoph Ortner <christophortner0@gmail.com>
# Licensed under ASL - see ASL.md for terms and conditions.
# --------------------------------------------------------------------------

"""
`mutable struct ToyModel` : a tight-binding type toy model admitting
multiple species, for testing the completeness of basis sets.
"""
mutable struct ToyModel{NZ} <: AbstractCalculator
   β::Float64
   eF::Float64
   zlist::SZList{NZ}
   α::Matrix{Float64}
end

function ToyModel(species; α = :rand, β = 1.0)
   zlist = ZList(species, static=true)
   if α == :rand
      α = 1.0 .+ 3 * rand(length(zlist), length(zlist))
      α = 0.5 * (α + α')
   end
   V = ToyModel(β, 0.0, ZList(species, static=true), α)
   V.eF = find_eF(V)
   return V
end

function find_eF(V)
   H = hamiltonian(rand_config(V), V)
   emin, emax = extrema(eigvals(H))
   for n = 1:30
      emin, emax = extrema([eigvals(H); [emin, emax]])
   end
   return 0.5 * (emin+emax)
end

fd(e, β) = 1/(1 + exp(β * e))
dfd(e, β) = (- β * exp(β * e)) / (1 + exp(β * e))^2

hop(r, α) = exp(-α * (r/3-1))
dhop(r, α) = - α/3 * exp(-α * (r/3-1))

function hamiltonian(at, V)
   X = positions(at)
   Z = at.Z
   H = zeros(length(at), length(at))
   for i = 1:length(at)-1, j = (i+1):length(at)
      α = V.α[ z2i(V.zlist, Z[i]), z2i(V.zlist, Z[j]) ]
      H[j, i] = H[i, j] = hop(norm(X[i]-X[j]), α)
   end
   return H
end

function hamiltonian_d(at::Atoms{T}, V) where {T}
   X = positions(at)
   Z = at.Z
   dH = zeros(JVec{T}, length(at), length(at))
   for i = 1:length(at), j = (i+1):length(at)
      α = V.α[ z2i(V.zlist, Z[i]), z2i(V.zlist, Z[j]) ]
      Rij = X[i]-X[j]
      rij = norm(Rij)
      dH[i, j] = dhop(rij, α) * (Rij / rij)
      dH[j, i] = - dH[i, j]
   end
   return dH
end

function energy(V::ToyModel, at::Atoms)
   H = hamiltonian(at, V)
   e = eigvals(H)
   # @show extrema(e)
   return sum(fd.(e .- V.eF, V.β))
end

function forces(V::ToyModel, at::Atoms)
   H = hamiltonian(at, V)
   e, Ψ = eigen(H)
   dH = hamiltonian_d(at, V)
   F = 2 * [ sum( dfd(e[n] - V.eF, V.β) * sum(Ψ[:, n] .* dH[:, j]) * Ψ[j, n]
                for n = 1:length(e) )
           for j = 1:length(at) ]
   # df_H = sum( dfd(e[n] - V.eF, V.β) * Ψ[:,n] * Ψ[:,n]'  for n = 1:length(e) )
   return F #  - sum(df_H .* dH; dims = 1)[:]
end

Base.rand(V::ToyModel; kwargs...) = rand_config(V; kwargs...)


text:
function analysis_minimization(path,data)

    fnames=readdir(path)
    Nconditions=length(fnames)

    PR_fit=[]
    PR_fit_test=[]
    LL_training=[]
    LL_test=[]
    Res=[]
    param=[]#zeros(Nconditions)
    hessian=[]
    ci=[]

    for icond in 1:(Nconditions)
            control=true
            #icond=111
            try
                    aux=load(path*fnames[icond])
                    #println(fnames[icond])
            catch e
                    println("something wrong in open file icond",icond)
                    control=false
            end

            if control
                    res=aux["res"]
                    if length(res["x_bf"])==10
                            #println(icond)
                            push!(Res,res)
                            push!(PR_fit,aux["PR"])
                            push!(PR_fit_test,aux["PR_test"])
                            push!(LL_training,res["f"])
                            push!(param,res["x_bf"])
                            push!(hessian,res["Hessian"])
                            ### compute ci from Hessian ####
                            push!(ci,compute_confidence_interval(res["Hessian"]))
                            Nstim=length(aux["PR"])
                            aux=LL_from_PR(aux["PR_test"],data["choices"][Nstim:2*Nstim])
                            push!(LL_test,aux)
                            #println(icond," ",res["f"]," ",LL_test[end]," ",res["x_bf"]," ",res["fit_time"]/3600.," ",res["x_ini"])#,res["fit_time"]/res["f_calls"] )
                    end
            end
    end

    save_dict=Dict([("LL_training",LL_training),("param",param),("LL_test",LL_test),
    ("hessian",hessian),("ci",ci),("PR_fit",PR_fit),("Res",Res)])

    return save_dict

end

function analysis_minimization_subjects(path)

    fnames=readdir(path)
    Nconditions=length(fnames)

    PR_training=[]
    PR_test=[]
    LL_training=[]
    LL_test=[]
    #Res=[]
    param_fit=[]#zeros(Nconditions)
    param_all=[]
    hessian=[]
    ci=[]
    control_test=false
    if contains(path,"training_test")
            control_test=true
    end
    #labels_param=["c21","c22","c4","st1","st2","st3","x0","bias_d"]
    #labels_param=["c21","c22","c4","st1","st2","x0"]

    aux=load(path*fnames[1])
    labels_param=arg_labels(aux["args"])
    param_dict_all=Dict([])
    for label in labels_param
           param_dict_all[label]=[]
    end
    #Nparamm=6
    println(labels_param)
    for icond in 1:(Nconditions)
            control=true
            #icond=111
            println(icond)

            try
                    aux=load(path*fnames[icond])
                    #println(fnames[icond])
                    #aux=load(path*fnames[icond])
                    res=aux["res"]
                    println(icond)

                    #push!(Res,res)
                    push!(PR_training,aux["PR_training"])
                    push!(LL_training,res["f"])
                    if control_test
                            push!(PR_test,aux["PR_test"])
                            push!(LL_test,aux["LL_test"])
                    end
                    push!(param_fit,res["x_bf"])
                    for (ilabel,label) in enumerate(labels_param)
                            append!(param_dict_all[label],res["x_bf"][ilabel])
                    end
                    param_dict=make_dict(aux["args"],res["x_bf"],aux["consts"],aux["z"])
                    push!(param_all,param_dict)

                    push!(hessian,res["Hessian"])
                    ### compute ci from Hessian ####
                    #push!(ci,compute_confidence_interval(res["Hessian"]))
                    push!(ci,res["ci"])

            catch e
                    println("something wrong in open file icond",icond)
                    println(path*fnames[icond])
                    control=false
            end

    end

    if control_test
            save_dict=Dict([("LL_training",LL_training),("LL_test",LL_test),
            ("param_fit",param_fit),("hessian",hessian),("ci",ci),
            ("PR_training",PR_training),("PR_test",PR_test),
            ("param_all",param_all) ])
            save_dict_final=merge(save_dict,param_dict_all)

    else
            save_dict=Dict([("LL_training",LL_training),("param_fit",param_fit),
            ("hessian",hessian),("ci",ci),("PR_training",PR_training),
            ("param_all",param_all)])
            save_dict_final=merge(save_dict,param_dict_all)
    end
    return save_dict_final

end

function compute_confidence_interval(H)
    z_aux=1.96
    ci=zeros(size(H)[1])
    try
        HI=inv(H)
        if all(diag(HI).>0)
            ci[:]=z_aux.*sqrt.(diag(HI))
            #println("A minimum ", ci)
        else
            ci[:]=-1.0
            #println("Not a minimum ", diag(HI))
        end

    catch e
        ci[:]=-2.0
        #println("H is not invertible")
    end
    return ci
end

max_stars_repo_name: emmafdz/FinalDegreeProject

max_issues_repo_name: emmafdz/FinalDegreeProject

max_forks_repo_name: emmafdz/FinalDegreeProject


text:
module DoseCalculators

export dose_calculator_app

using Gtk

const _apps = GtkWindow[]
const _apps_should_persist = [true]

"""
    dose_calculator_app(func::Function, title = "Dose Calculator", rlabel = "Results")

Create a `Gtk` widget with entries for `weight`, `height`, `age`, and dose interval.
Arguments:
`func` is a function which takes named arguments age = years, weight =  kg, height = cm and returns total 24-hour dosage in mg.
`title` is the title for the app
`rlabel` is the label to be given the results
"""
function dose_calculator_app(func::Function, title = "Dose Calculator", rlabel = "Results")
    wentry, aentry, hentry, qentry = GtkEntry(), GtkEntry(), GtkEntry(), GtkEntry()
    weightunits = [GtkRadioButton("kg")]
    push!(weightunits, GtkRadioButton(weightunits[1], "lb"))
    ageunits = [GtkRadioButton("years")]
    push!(ageunits, GtkRadioButton(ageunits[1], "months"))
    heightunits = [GtkRadioButton("cm")]
    push!(heightunits, GtkRadioButton(heightunits[1], "in"))
    resultbutton = GtkButton("Calculate")
    resultlabel = GtkLabel("0")
    win = GtkWindow(title, 500, 100) |> (GtkFrame() |> (vbox = GtkBox(:v)))
    push!(_apps, win)
    wbox = GtkButtonBox(:h)
    push!(wbox, GtkLabel("Patient Weight"), wentry, weightunits...)
    abox = GtkButtonBox(:h)
    push!(abox, GtkLabel("Age"), aentry, ageunits...)
    hbox = GtkButtonBox(:h)
    push!(hbox, GtkLabel("Height"), hentry, heightunits...)
    resultbox = GtkButtonBox(:h)
    qbox = GtkButtonBox(:h)
    push!(qbox, GtkLabel("Give medication every: "), qentry, GtkLabel(" hours."))
    set_gtk_property!(qentry, :text, "12")
    push!(resultbox, GtkLabel(rlabel), resultlabel, resultbutton)
    push!(vbox, wbox, abox, hbox, qbox, resultbox)

    function calculate(w)
        wt = something(tryparse(Float64, get_gtk_property(wentry, :text, String)), 0) /
            (get_gtk_property(weightunits[1], :active, Bool) ? 1 : 0.393701)
        ht = something(tryparse(Float64, get_gtk_property(hentry, :text, String)), 0) *
            (get_gtk_property(heightunits[1], :active, Bool) ? 1 : 2.20462)
        ag = something(tryparse(Float64, get_gtk_property(aentry, :text, String)), 0) /
            (get_gtk_property(ageunits[1], :active, Bool) ? 1 : 12)
        result = func(weight = wt, height = ht, age = ag)
        dosagefraction = parse(Float64, get_gtk_property(qentry, :text, String)) / 24
        GAccessor.text(resultlabel, "                      ")
        GAccessor.text(resultlabel, string(result * dosagefraction))
    end

    signal_connect(calculate, resultbutton, :clicked)

    if _apps_should_persist[1]
        cond = Condition()
        endit(w) = notify(cond)
        signal_connect(endit, win, :destroy)
        showall(win)
        wait(cond)
    else
        sleep(5)
    end
end

end # module


text:
@testset "test internal functions" begin
        @testset "test for pandapower to powermodels format convertion" begin
                pm = _PdM.load_pm_from_json(case_pm)

                @test length(pm["bus"]) == 6
                @test length(pm["gen"]) == 3
                @test length(pm["branch"]) == 7
                @test length(pm["load"]) == 3

                model = _PdM.get_model(pm["pm_model"])
                @test string(model) == "PowerModels.DCPPowerModel"

                solver = _PdM.get_solver(pm)

                @test string(solver.optimizer_constructor) == "Ipopt.Optimizer"
        end

        @testset "test for pandapower parameters" begin
                pm = _PdM.load_pm_from_json(case_vstab)
                params = _PdM.extract_params!(pm)

                @test haskey(params, :setpoint_v)
                @test length(params[:setpoint_v]) >= 9

        end

        @testset "test for current limit" begin
                pm = _PdM.load_pm_from_json(case_opf_cl)
                cl = _PdM.check_current_limit!(pm)
                @test cl == length(pm["branch"])
                @test cl == 7

                pm = _PdM.load_pm_from_json(case_opf_ac)
                @test pm["ac"] == true
                cl = _PdM.check_current_limit!(pm)
                @test cl == 0

        end

end


text:
include("../gcc_common.jl")
build_and_upload_gcc(v"9.1.0")

max_stars_repo_name: sharanry/Yggdrasil

max_issues_repo_name: sharanry/Yggdrasil

max_forks_repo_name: sharanry/Yggdrasil


text:
# This is part of Quiz.jl. License is MIT.

println("Quiz testing...")

include("types.jl")


text:
# This file contains functions for the Profitability Efficiency DEA model
"""
    ProfitabilityDEAModel
An data structure representing a profitability DEA model.
"""
struct ProfitabilityDEAModel <: AbstractProfitabilityDEAModel
    n::Int64
    m::Int64
    s::Int64
    alpha::Float64
    dmunames::Union{Vector{String},Nothing}
    eff::Vector
    lambda::SparseMatrixCSC{Float64, Int64}
    crseff::Vector
    vrseff::Vector
    scaleff::Vector
    alloceff::Vector
    Xtarget::Matrix
    Ytarget::Matrix
end

"""
    deaprofitability(X, Y, W, P)
Compute profitability efficiency using data envelopment analysis for
inputs `X`, outputs `Y`, price of inputs `W`, and price of outputs `P`.

# Optional Arguments
- `alpha=0.5`: alpha to use for the generalized distance function.
- `names`: a vector of strings with the names of the decision making units.

# Examples
```jldoctest
julia> X = [5 3; 2 4; 4 2; 4 8; 7 9.0];

julia> Y = [7 4; 10 8; 8 10; 5 4; 3 6.0];

julia> W = [2 1; 2 1; 2 1; 2 1; 2 1.0];

julia> P = [3 2; 3 2; 3 2; 3 2; 3 2.0];

julia> deaprofitability(X, Y, W, P)
Profitability DEA Model
DMUs = 5; Inputs = 2; Outputs = 2
alpha = 0.5; Returns to Scale = VRS
─────────────────────────────────────────────────────────
   Profitability       CRS      VRS     Scale  Allocative
─────────────────────────────────────────────────────────
1       0.38796   0.636364  0.68185  0.93329     0.609651
2       1.0       1.0       1.0      1.0         1.0
3       0.765217  1.0       1.0      1.0         0.765217
4       0.25      0.25      0.25     1.0         1.0
5       0.15879   0.26087   0.36     0.724638    0.608696
─────────────────────────────────────────────────────────
```
"""
function deaprofitability(X::Union{Matrix,Vector}, Y::Union{Matrix,Vector},
    W::Union{Matrix,Vector}, P::Union{Matrix,Vector};
    alpha::Float64 = 0.5,
    names::Union{Vector{String},Nothing} = nothing,
    optimizer::Union{DEAOptimizer,Nothing} = nothing)::ProfitabilityDEAModel

    # Check parameters
    nx, m = size(X, 1), size(X, 2)
    ny, s = size(Y, 1), size(Y, 2)

    nw, mw = size(W, 1), size(W, 2)
    np, sp = size(P, 1), size(P, 2)

    if nx != ny
        throw(DimensionMismatch("number of rows in X and Y ($nx, $ny) are not equal"));
    end
    if nw != nx
        throw(DimensionMismatch("number of rows in W and X ($nw, $nx) are not equal"));
    end
    if np != ny
        throw(DimensionMismatch("number of rows in P and Y ($np, $ny) are not equal"));
    end
    if mw != m
        throw(DimensionMismatch("number of columns in W and X ($mw, $m) are not equal"));
    end
    if sp != s
        throw(DimensionMismatch("number of columns in P and Y ($sp, $s) are not equal"));
    end

    # Default optimizer
    if optimizer === nothing
        optimizer = DEAOptimizer(:NLP)
    end

    # Compute efficiency for each DMU
    n = nx

    Xtarget = zeros(n,m)
    Ytarget = zeros(n,s)
    pefficiency = zeros(n)
    plambdaeff = spzeros(n, n)

    for i=1:n
        # Value of inputs and outputs to evaluate
        x0 = X[i,:]
        y0 = Y[i,:]
        w0 = W[i,:]
        p0 = P[i,:]

        # Create the optimization model
        deamodel = newdeamodel(optimizer)

        @variable(deamodel, eff, start = 1.0)
        @variable(deamodel, lambda[1:n] >= 0)

        @NLobjective(deamodel, Min, eff)

        @NLconstraint(deamodel, sum(sum(w0[mi] * X[t,mi] for mi in 1:m) / sum(p0[si] * Y[t,si] for si in 1:s) * lambda[t] for t in 1:n) == eff * sum(w0[j] * x0[j] for j in 1:m ) / sum(p0[j] * y0[j] for j in 1:s))

        @constraint(deamodel, sum(lambda) == 1)

        # Optimize and return results
        JuMP.optimize!(deamodel)

        pefficiency[i]  = JuMP.objective_value(deamodel)
        plambdaeff[i,:] = JuMP.value.(lambda)
        Xtarget[i,:] = X[i,:] .* pefficiency[i] ^(1-alpha)
        Ytarget[i,:] = Y[i,:] ./ ( pefficiency[i] ^alpha )

        # Check termination status
        if (termination_status(deamodel) != MOI.OPTIMAL) && (termination_status(deamodel) != MOI.LOCALLY_SOLVED)
            @warn ("DMU $i termination status: $(termination_status(deamodel)). Primal status: $(primal_status(deamodel)). Dual status: $(dual_status(deamodel))")
        end

    end

    # Technical, scale and allocative efficiency
    crsefficiency = efficiency(deagdf(X, Y, alpha = alpha, rts = :CRS, slack = false, optimizer = optimizer))
    vrsefficiency = efficiency(deagdf(X, Y, alpha = alpha, rts = :VRS, slack = false, optimizer = optimizer))
    scalefficiency = crsefficiency ./ vrsefficiency
    allocefficiency = pefficiency ./ crsefficiency

    return ProfitabilityDEAModel(n, m, s, alpha, names, pefficiency, plambdaeff, crsefficiency, vrsefficiency, scalefficiency, allocefficiency, Xtarget, Ytarget)

end

function Base.show(io::IO, x::ProfitabilityDEAModel)
    compact = get(io, :compact, false)

    n = nobs(x)
    m = ninputs(x)
    s = noutputs(x)
    dmunames = names(x)

    eff = efficiency(x)
    crseff = efficiency(x, :CRS)
    vrseff = efficiency(x, :VRS)
    scaleeff = efficiency(x, :Scale)
    alloceff = efficiency(x, :Allocative)

    if !compact
        print(io, "Profitability DEA Model \n")
        print(io, "DMUs = ", n)
        print(io, "; Inputs = ", m)
        print(io, "; Outputs = ", s)
        print(io, "\n")
        print(io, "alpha = ", x.alpha)
        print(io, "; Returns to Scale = VRS")
        print(io, "\n")
        show(io, CoefTable(hcat(eff, crseff, vrseff, scaleeff, alloceff), ["Profitability", "CRS", "VRS", "Scale", "Allocative"], dmunames))
    end

end


text:
import PyPlot

function savefigs_pyplot(report::Report)
    chunk = report.cur_chunk
    fignames = AbstractString[]
    ext = report.formatdict[:fig_ext]
    figpath = joinpath(report.cwd, chunk.options[:fig_path])
    isdir(figpath) || mkdir(figpath)
    chunkid = (chunk.options[:label] == nothing) ? chunk.number : chunk.options[:label]
    #Iterate over all open figures, save them and store names

    for fig = PyPlot.plt[:get_fignums]()
        full_name, rel_name = get_figname(report, chunk, fignum=fig)
        PyPlot.savefig(full_name, dpi=chunk.options[:dpi])
        push!(report.figures, rel_name)
        report.fignum += 1
        PyPlot.plt[:draw]()
        PyPlot.plt[:close]()
    end
end


text:
precompile(Tuple{typeof(Base.similar), Array{Base.Grisu.Bignums.Bignum, 1}})
precompile(Tuple{typeof(Base.length), Array{Base.Grisu.Bignums.Bignum, 1}})
precompile(Tuple{typeof(Base.deepcopy_internal), Any, Base.IdDict{Any, Any}})
precompile(Tuple{typeof(Base.deepcopy_internal), Array{UInt32, 1}, Base.IdDict{Any, Any}})
precompile(Tuple{typeof(Parsers.__init__)})
precompile(Tuple{typeof(Base.GMP.MPZ.set), Base.GMP.BigInt})
precompile(Tuple{typeof(Base.deepcopy), Base.GMP.BigInt})
precompile(Tuple{typeof(Base.Threads.resize_nthreads!), Array{Base.GMP.BigInt, 1}, Base.GMP.BigInt})
precompile(Tuple{typeof(Base.foreach), getfield(Parsers, Symbol("#25#30")), Array{Base.GMP.BigInt, 1}})
precompile(Tuple{typeof(Base.foreach), getfield(Parsers, Symbol("#26#31")), Array{Base.GMP.BigInt, 1}})
precompile(Tuple{typeof(Base.foreach), getfield(Parsers, Symbol("#27#32")), Array{Base.GMP.BigInt, 1}})
precompile(Tuple{typeof(Base.foreach), getfield(Parsers, Symbol("#28#33")), Array{Base.GMP.BigInt, 1}})
precompile(Tuple{typeof(Base.foreach), getfield(Parsers, Symbol("#29#34")), Array{Base.GMP.BigInt, 1}})
precompile(Tuple{typeof(FilePathsBase.__init__)})
precompile(Tuple{typeof(CSV.__init__)})
precompile(Tuple{getfield(Base, Symbol("#@ccallable")), LineNumberNode, Module, Any})
precompile(Tuple{typeof(Base.expand_ccallable), Nothing, Expr})
precompile(Tuple{getfield(Base.Cartesian, Symbol("#@nexprs")), LineNumberNode, Module, Int64, Expr})
precompile(Tuple{typeof(Base.Cartesian.exprresolve_arith), Expr})
precompile(Tuple{typeof(Base.Cartesian.exprresolve_conditional), Expr})
precompile(Tuple{typeof(Base.Cartesian.exprresolve), Expr})
precompile(Tuple{typeof(Base.Cartesian.inlineanonymous), Expr, Int64})
precompile(Tuple{typeof(Base.Cartesian.lreplace!), Expr, Base.Cartesian.LReplace{String}})
precompile(Tuple{typeof(Base.Cartesian.lreplace), Expr, Symbol, Int64})
precompile(Tuple{getfield(Base.Cartesian, Symbol("#@ncall")), LineNumberNode, Module, Int64, Any, Vararg{Any, N} where N})
precompile(Tuple{getfield(Base.Cartesian, Symbol("#@nloops")), LineNumberNode, Module, Any, Any, Any, Vararg{Any, N} where N})
precompile(Tuple{typeof(Base.Cartesian._nloops), Int64, Symbol, Expr, Expr})
precompile(Tuple{typeof(Base.map), Function, Array{Any, 1}})
precompile(Tuple{Type{Base.Generator{I, F} where F where I}, getfield(Base, Symbol("#267#268")), Array{Any, 1}})
precompile(Tuple{typeof(Base._collect), Array{Any, 1}, Base.Generator{Array{Any, 1}, getfield(Base, Symbol("#267#268"))}, Base.EltypeUnknown, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_similar), Array{Any, 1}, Base.Generator{Array{Any, 1}, getfield(Base, Symbol("#267#268"))}})
precompile(Tuple{typeof(Base.ccallable), Function, Type{T} where T, Type{T} where T, String})
precompile(Tuple{getfield(Base, Symbol("##catch_stack#49")), Bool, typeof(Base.catch_stack), Task})
precompile(Tuple{typeof(CSV2Parquet.julia_main)})
precompile(Tuple{typeof(Core.Compiler.zero), Type{Int128}})
precompile(Tuple{typeof(Core.Compiler.zero), Type{UInt8}})
precompile(Tuple{typeof(Base.println), String, Int64})
precompile(Tuple{typeof(DataFrames.nrow), DataFrames.DataFrame})
precompile(Tuple{typeof(Base.println), String, Tuple{Int64, Int64}})
precompile(Tuple{typeof(Base.stat), Mmap.Anonymous})
precompile(Tuple{typeof(Base.Filesystem.filesize), Mmap.Anonymous})
precompile(Tuple{getfield(Mmap, Symbol("##mmap#1")), Bool, Bool, typeof(Mmap.mmap), Mmap.Anonymous, Type{Array{UInt8, 1}}, Tuple{Int64}, Int64})
precompile(Tuple{typeof(Base.read_sub), Base.GenericIOBuffer{Base.SubArray{UInt8, 1, Array{UInt8, 1}, Tuple{Base.UnitRange{Int64}}, true}}, Array{UInt8, 1}, Int64, Int64})
precompile(Tuple{typeof(CSV.slurp), Base.GenericIOBuffer{Base.SubArray{UInt8, 1, Array{UInt8, 1}, Tuple{Base.UnitRange{Int64}}, true}}})
precompile(Tuple{typeof(CSV.skiptorow), CSV.ReversedBuf, Int64, Int64, UInt8, UInt8, UInt8, Int64, Int64})
precompile(Tuple{typeof(CSV.skiptorow), Array{UInt8, 1}, Int64, Int64, UInt8, UInt8, UInt8, Int64, Int64})
precompile(Tuple{typeof(CSV.checkcommentandemptyline), Array{UInt8, 1}, Int64, Int64, Nothing, Bool})
precompile(Tuple{typeof(CSV.detectheaderdatapos), Array{UInt8, 1}, Int64, Int64, UInt8, UInt8, UInt8, Nothing, Bool, Int64, Int64})
precompile(Tuple{typeof(CSV.detectdelimandguessrows), Array{UInt8, 1}, Int64, Int64, Int64, UInt8, UInt8, UInt8, UInt8, Nothing, Bool})
precompile(Tuple{Type{Parsers.Options{ignorerepeated, ignoreemptylines, Q, debug, S, D, DF} where DF where D where S where debug where Q where ignoreemptylines where ignorerepeated}, Base.Missing, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, Nothing, Nothing, Nothing, Bool, Bool, Nothing, Bool, Bool, Bool, Bool})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{Int8, Type}, Int8})
precompile(Tuple{typeof(Base.copyto!), Array{Base.Pair{String, UInt64}, 1}, Base.Dict{String, UInt64}})
precompile(Tuple{typeof(Base.sort!), Array{Base.Pair{String, UInt64}, 1}, Int64, Int64, Base.Sort.InsertionSortAlg, Base.Order.By{getfield(CSV, Symbol("#21#29"))}})
precompile(Tuple{typeof(Base.sort!), Array{Base.Pair{String, UInt64}, 1}, Int64, Int64, Base.Sort.MergeSortAlg, Base.Order.By{getfield(CSV, Symbol("#21#29"))}, Array{Base.Pair{String, UInt64}, 1}})
precompile(Tuple{typeof(Random.make_seed)})
precompile(Tuple{Type{Random.MersenneTwister}, Nothing})
precompile(Tuple{typeof(Random.default_rng), Int64})
precompile(Tuple{typeof(Base.rand), Type{Bool}})
precompile(Tuple{getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}, Int64})
precompile(Tuple{typeof(Base.collect), Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}})
precompile(Tuple{typeof(Base._deleteat!), Array{Symbol, 1}, Array{Int64, 1}})
precompile(Tuple{typeof(Base._deleteat!), Array{Type, 1}, Array{Int64, 1}})
precompile(Tuple{typeof(Base._deleteat!), Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}, Array{Int64, 1}})
precompile(Tuple{typeof(Base.grow_to!), Base.Dict{Any, Any}, Base.Generator{Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}}}, getfield(CSV, Symbol("#23#31"))}})
precompile(Tuple{typeof(Base._all), getfield(Base, Symbol("#239#241")), Base.Generator{Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}}}, getfield(CSV, Symbol("#23#31"))}, Base.Colon})
precompile(Tuple{Type{Base.Dict{K, V} where V where K}, Base.Generator{Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}}}, getfield(CSV, Symbol("#23#31"))}})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{String, 1}, String, Base.Generator{Array{Base.Pair{String, UInt64}, 1}, getfield(CSV, Symbol("#20#28"))}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{String, 1}, Array{String, 1}, Int64})
precompile(Tuple{Type{Array{String, 1}}, Array{Array{String, 1}, 1}})
precompile(Tuple{typeof(Base.fill!), Array{Union{Nothing, Array{String, 1}}, 1}, Nothing})
precompile(Tuple{Type{Base.Val{x} where x}, Bool})
precompile(Tuple{typeof(Base.collect_to!), Array{Tuple{Ptr{UInt8}, Int64}, 1}, Base.Generator{Array{String, 1}, typeof(Parsers.ptrlen)}, Int64, Int64})
precompile(Tuple{typeof(Base._collect), Array{String, 1}, Base.Generator{Array{String, 1}, typeof(Parsers.ptrlen)}, Base.EltypeUnknown, Base.HasShape{1}})
precompile(Tuple{typeof(Base.sort!), Array{Tuple{Ptr{UInt8}, Int64}, 1}, Int64, Int64, Base.Sort.InsertionSortAlg, Base.Order.By{getfield(Parsers, Symbol("#1#2"))}})
precompile(Tuple{typeof(Base.sort!), Array{Tuple{Ptr{UInt8}, Int64}, 1}, Int64, Int64, Base.Sort.MergeSortAlg, Base.Order.By{getfield(Parsers, Symbol("#1#2"))}, Array{Tuple{Ptr{UInt8}, Int64}, 1}})
precompile(Tuple{typeof(Base.sort!), Array{Tuple{Ptr{UInt8}, Int64}, 1}, Int64, Int64, Base.Sort.InsertionSortAlg, Base.Order.ReverseOrdering{Base.Order.By{getfield(Parsers, Symbol("#1#2"))}}})
precompile(Tuple{typeof(Base.sort!), Array{Tuple{Ptr{UInt8}, Int64}, 1}, Int64, Int64, Base.Sort.MergeSortAlg, Base.Order.ReverseOrdering{Base.Order.By{getfield(Parsers, Symbol("#1#2"))}}, Array{Tuple{Ptr{UInt8}, Int64}, 1}})
precompile(Tuple{typeof(Parsers.prepare), Array{String, 1}})
precompile(Tuple{Type{Parsers.Options{ignorerepeated, ignoreemptylines, Q, debug, S, D, DF} where DF where D where S where debug where Q where ignoreemptylines where ignorerepeated}, Array{String, 1}, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, Nothing, Nothing, Nothing, Bool, Bool, Nothing, Bool, Bool, Bool, Bool})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{Any, Int64}, Symbol})
precompile(Tuple{typeof(CSV.file), Base.GenericIOBuffer{Base.SubArray{UInt8, 1, Array{UInt8, 1}, Tuple{Base.UnitRange{Int64}}, true}}, Int64, Bool, Int64, Nothing, Int64, Int64, Bool, Nothing, Bool, Bool, Nothing, Nothing, Nothing, Array{String, 1}, String, Nothing, Bool, Char, Nothing, Nothing, Char, Nothing, UInt8, Nothing, Nothing, Nothing, Nothing, Base.Dict{Int8, Int8}, Bool, Float64, Bool, Bool, Bool, Bool, Nothing})
precompile(Tuple{typeof(Base.throw_boundserror), Array{AbstractArray{T, 1} where T, 1}, Tuple{Base.OneTo{Int64}}})
precompile(Tuple{typeof(Base.copyto!), Array{AbstractArray{T, 1} where T, 1}, Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}})
precompile(Tuple{typeof(Base.throw_checksize_error), Array{Symbol, 1}, Tuple{Base.OneTo{Int64}}})
precompile(Tuple{typeof(Base._unsafe_getindex), Base.IndexLinear, Array{Symbol, 1}, Array{Int64, 1}})
precompile(Tuple{typeof(Base.throw_boundserror), Base.Broadcast.Broadcasted{Nothing, Tuple{Base.OneTo{Int64}}, typeof(Base.string), Tuple{Base.Broadcast.Extruded{Array{Char, 0}, Tuple{}, Tuple{}}, Base.Broadcast.Extruded{Array{Symbol, 1}, Tuple{Bool}, Tuple{Int64}}}}, Tuple{Int64}})
precompile(Tuple{typeof(Base.throw_boundserror), Array{Symbol, 1}, Tuple{Array{Int64, 1}}})
precompile(Tuple{getfield(DataFrames, Symbol("##make_unique!#1")), Bool, typeof(DataFrames.make_unique!), Array{Symbol, 1}, Array{Symbol, 1}})
precompile(Tuple{Type{Base.Dict{Symbol, Int64}}})
precompile(Tuple{typeof(Base.rehash!), Base.Dict{Symbol, Int64}, Int64})
precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{Symbol, Int64}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Int64}, Int64, Symbol})
precompile(Tuple{Type{Base.Dict{Symbol, Int64}}, Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Base.UnitRange{Int64}}}})
precompile(Tuple{typeof(Base.collect), Base.Generator{Array{AbstractArray{T, 1} where T, 1}, getfield(DataFrames, Symbol("#94#97"))}})
precompile(Tuple{typeof(Base.throw_boundserror), Base.Broadcast.Broadcasted{Nothing, Tuple{Base.OneTo{Int64}}, typeof(Base.string), Tuple{Base.Broadcast.Extruded{Array{Symbol, 1}, Tuple{Bool}, Tuple{Int64}}}}, Tuple{Int64}})
precompile(Tuple{getfield(DataFrames, Symbol("#DataFrame#93#96")), Bool, Type{DataFrames.DataFrame}, Array{AbstractArray{T, 1} where T, 1}, DataFrames.Index})
precompile(Tuple{getfield(DataFrames, Symbol("##DataFrame#108")), Bool, Bool, Type{DataFrames.DataFrame}, Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}, Array{Symbol, 1}})
precompile(Tuple{typeof(Base.iterate), DataConvenience.CsvChunkIterator})
precompile(Tuple{typeof(CSV2Parquet.real_main)})
precompile(Tuple{typeof(Base.iterate), Base.Iterators.Enumerate{DataConvenience.CsvChunkIterator}, Tuple{Int64}})
precompile(Tuple{typeof(Base.cconvert), Type{Base.Cwstring}, String})
precompile(Tuple{Type{Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}}, Array{String, 1}, Base.Missing, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, Nothing, Nothing, Nothing, Nothing, Bool, Bool})
precompile(Tuple{typeof(Base.collect_to!), Array{Symbol, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#8#11"))}, Int64, Int64})
precompile(Tuple{typeof(Base.collect), Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#8#11"))}})
precompile(Tuple{typeof(CSV.unescape), CSV.PointerString, UInt8})
precompile(Tuple{typeof(CSV.columnname), Array{UInt8, 1}, Int64, Int64, Int16, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64})
precompile(Tuple{typeof(Parsers.checkcmtemptylines), Array{UInt8, 1}, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}})
precompile(Tuple{typeof(Base.Unicode.utf8proc_error), Int64})
precompile(Tuple{typeof(Base.Unicode.utf8proc_map), String, Int64})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{String, Nothing}, Base.SubString{String}})
precompile(Tuple{typeof(Base.map), getfield(CSV, Symbol("#4#5")), Base.SubString{String}})
precompile(Tuple{typeof(CSV.normalizename), String})
precompile(Tuple{typeof(Base.collect_to!), Array{Symbol, 1}, Base.Generator{Array{String, 1}, getfield(CSV, Symbol("#9#12")){Bool}}, Int64, Int64})
precompile(Tuple{typeof(Base.collect), Base.Generator{Array{String, 1}, getfield(CSV, Symbol("#9#12")){Bool}}})
precompile(Tuple{typeof(CSV.makeunique), Array{Symbol, 1}})
precompile(Tuple{typeof(CSV.detectcolumnnames), Array{UInt8, 1}, Int64, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64, Bool})
precompile(Tuple{typeof(CSV.findrowstarts!), Array{UInt8, 1}, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Nothing, Bool, Array{Int64, 1}, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Array{Int8, 1}, 1}, Array{Int8, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#33#36")){Array{Int8, 1}}}, Int64})
precompile(Tuple{typeof(Base.collect), Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#33#36")){Array{Int8, 1}}}})
precompile(Tuple{typeof(Base.vcat), Base.UnitRange{UInt64}})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{String, UInt64}, String})
precompile(Tuple{typeof(Base.rehash!), Base.Dict{String, UInt64}, Int64})
precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{String, UInt64}, String})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{String, UInt64}, UInt64, String})
precompile(Tuple{typeof(CSV.multithreadparse), Array{Int8, 1}, Array{UInt8, 1}, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64, Float64, Int64, Bool, Base.Dict{Int8, Int8}, Int64, Nothing, Bool})
precompile(Tuple{getfield(Mmap, Symbol("#3#5")){Ptr{Nothing}, Ptr{Nothing}}, Array{UInt8, 1}})
precompile(Tuple{typeof(Base.iterate), Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#32#35")){Int64, Int64}}})
precompile(Tuple{typeof(Base.iterate), Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#32#35")){Int64, Int64}}, Int64})
precompile(Tuple{typeof(Base._reformat_bt), Array{Ptr{Nothing}, 1}, Array{Any, 1}})
precompile(Tuple{typeof(Base.catch_backtrace)})
precompile(Tuple{typeof(Distributed.flush_gc_msgs)})
precompile(Tuple{getfield(Distributed, Symbol("#131#132"))})
precompile(Tuple{Type{Base.Val{false}}})
precompile(Tuple{typeof(Dates.character_codes), Core.SimpleVector})
precompile(Tuple{getfield(Parsers, Symbol("##s44#15")), Any, Any, Any, Any, Any, Any, Any})
precompile(Tuple{typeof(Dates.character_codes), Type{Dates.DateFormat{Symbol("yyyy-mm-dd"), Tuple{Dates.DatePart{Char(0x79000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x6d000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x64000000)}}}}})
precompile(Tuple{typeof(Base.first), Core.SimpleVector})
precompile(Tuple{typeof(Dates.genvar), DataType})
precompile(Tuple{Type{Base.IteratorSize}, Tuple{DataType, DataType, DataType}})
precompile(Tuple{typeof(Base._array_for), Type{Symbol}, Tuple{DataType, DataType, DataType}, Base.HasLength})
precompile(Tuple{Type{Base.LinearIndices{N, R} where R<:Tuple{Vararg{Base.AbstractUnitRange{Int64}, N}} where N}, Array{Symbol, 1}})
precompile(Tuple{Type{Base.Generator{I, F} where F where I}, getfield(Parsers, Symbol("#16#17")), Tuple{DataType, DataType, DataType}})
precompile(Tuple{typeof(Base.collect), Base.Generator{Tuple{DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}})
precompile(Tuple{Type{Tuple}, Base.Generator{Tuple{DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}})
precompile(Tuple{typeof(Base._array_for), Type{Int64}, Tuple{DataType, DataType, DataType}, Base.HasLength})
precompile(Tuple{typeof(Base.collect_to!), Array{Int64, 1}, Base.Generator{Tuple{DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Int64, 1}, Int64, Base.Generator{Tuple{DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}, Int64})
precompile(Tuple{typeof(Base.Iterators.zip), Array{Symbol, 1}, Vararg{Any, N} where N})
precompile(Tuple{Type{Base.Iterators.Zip{Is} where Is<:Tuple}, Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64}}})
precompile(Tuple{Type{Base.IteratorSize}, Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64}}}})
precompile(Tuple{typeof(Base._array_for), Type{Expr}, Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64}}}, Base.HasLength})
precompile(Tuple{Type{Base.LinearIndices{N, R} where R<:Tuple{Vararg{Base.AbstractUnitRange{Int64}, N}} where N}, Array{Expr, 1}})
precompile(Tuple{typeof(Base.map), getfield(Base.Iterators, Symbol("#3#4")), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64}}})
precompile(Tuple{typeof(Base.Iterators._zip_iterate_all), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64}}, Tuple{Tuple{}, Tuple{}}})
precompile(Tuple{typeof(Base.iterate), Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64}}}, Tuple{Int64, Int64}})
precompile(Tuple{typeof(Base.collect), Base.Generator{Array{Type, 1}, getfield(Parsers, Symbol("#19#20"))}})
precompile(Tuple{getfield(Parsers, Symbol("##s44#18")), Any, Any, Any, Any, Any})
precompile(Tuple{typeof(Dates._directives), Type{Dates.DateFormat{Symbol("yyyy-mm-dd"), Tuple{Dates.DatePart{Char(0x79000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x6d000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x64000000)}}}}})
precompile(Tuple{typeof(Base._array_for), Type{Int64}, Array{Type, 1}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{Int64, 1}, Base.Generator{Array{Type, 1}, getfield(Parsers, Symbol("#19#20"))}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Int64, 1}, Int64, Base.Generator{Array{Type, 1}, getfield(Parsers, Symbol("#19#20"))}, Int64})
precompile(Tuple{typeof(Dates.character_codes), Type{Dates.DateFormat{Symbol("yyyy-mm-dd\THH:MM:SS.s"), Tuple{Dates.DatePart{Char(0x79000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x6d000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x64000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x48000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x4d000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x53000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x73000000)}}}}})
precompile(Tuple{Type{Base.IteratorSize}, Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}})
precompile(Tuple{typeof(Base._array_for), Type{Symbol}, Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}, Base.HasLength})
precompile(Tuple{Type{Base.Generator{I, F} where F where I}, getfield(Parsers, Symbol("#16#17")), Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}})
precompile(Tuple{typeof(Base.collect), Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}})
precompile(Tuple{Type{Tuple}, Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}})
precompile(Tuple{typeof(Base._array_for), Type{Int64}, Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}, Base.HasLength})
precompile(Tuple{typeof(Base.collect_to!), Array{Int64, 1}, Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Int64, 1}, Int64, Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}, Int64})
precompile(Tuple{typeof(Base.copyto!), Array{Any, 1}, Int64, Array{Int64, 1}, Int64, Int64})
precompile(Tuple{typeof(Base.setindex_widen_up_to), Array{Int64, 1}, Dates.AMPM, Int64})
precompile(Tuple{typeof(Base.collect_to!), Array{Any, 1}, Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}, Int64, Int64})
precompile(Tuple{Type{Base.Iterators.Zip{Is} where Is<:Tuple}, Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}})
precompile(Tuple{Type{Base.IteratorSize}, Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}}})
precompile(Tuple{typeof(Base._array_for), Type{Expr}, Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}}, Base.HasLength})
precompile(Tuple{typeof(Base.map), getfield(Base.Iterators, Symbol("#3#4")), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}})
precompile(Tuple{typeof(Base.Iterators._zip_iterate_all), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}, Tuple{Tuple{}, Tuple{}}})
precompile(Tuple{typeof(Base.iterate), Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}}, Tuple{Int64, Int64}})
precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Symbol, Dates.AMPM}, Int64})
precompile(Tuple{typeof(Base.indexed_iterate), Tuple{Symbol, Dates.AMPM}, Int64, Int64})
precompile(Tuple{typeof(Dates._directives), Type{Dates.DateFormat{Symbol("yyyy-mm-dd\THH:MM:SS.s"), Tuple{Dates.DatePart{Char(0x79000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x6d000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x64000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x48000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x4d000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x53000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x73000000)}}}}})
precompile(Tuple{Type{Base.Iterators.Zip{Is} where Is<:Tuple}, Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64}}})
precompile(Tuple{typeof(Base.map), getfield(Base.Iterators, Symbol("#3#4")), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64}}})
precompile(Tuple{typeof(Base.Iterators._zip_iterate_all), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64}}, Tuple{Tuple{}, Tuple{}}})
precompile(Tuple{typeof(Base.iterate), Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Int64}}}, Tuple{Int64, Int64}})
precompile(Tuple{typeof(Dates.character_codes), Type{Dates.DateFormat{Symbol("HH:MM:SS.s"), Tuple{Dates.DatePart{Char(0x48000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x4d000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x53000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x73000000)}}}}})
precompile(Tuple{Type{Base.IteratorSize}, Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}})
precompile(Tuple{typeof(Base._array_for), Type{Symbol}, Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}, Base.HasLength})
precompile(Tuple{Type{Base.Generator{I, F} where F where I}, getfield(Parsers, Symbol("#16#17")), Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}})
precompile(Tuple{typeof(Base.collect), Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}})
precompile(Tuple{Type{Tuple}, Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}})
precompile(Tuple{typeof(Base._array_for), Type{Int64}, Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}, Base.HasLength})
precompile(Tuple{typeof(Base.collect_to!), Array{Int64, 1}, Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Int64, 1}, Int64, Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}, Int64})
precompile(Tuple{typeof(Base.collect_to!), Array{Any, 1}, Base.Generator{Tuple{DataType, DataType, DataType, DataType, DataType, DataType, DataType}, getfield(Parsers, Symbol("#16#17"))}, Int64, Int64})
precompile(Tuple{Type{Base.Iterators.Zip{Is} where Is<:Tuple}, Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}})
precompile(Tuple{Type{Base.IteratorSize}, Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}}})
precompile(Tuple{typeof(Base._array_for), Type{Expr}, Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}}, Base.HasLength})
precompile(Tuple{typeof(Base.map), getfield(Base.Iterators, Symbol("#3#4")), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}})
precompile(Tuple{typeof(Base.Iterators._zip_iterate_all), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}, Tuple{Tuple{}, Tuple{}}})
precompile(Tuple{typeof(Base.iterate), Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM}}}, Tuple{Int64, Int64}})
precompile(Tuple{typeof(Dates._directives), Type{Dates.DateFormat{Symbol("HH:MM:SS.s"), Tuple{Dates.DatePart{Char(0x48000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x4d000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x53000000)}, Dates.Delim{Char, 1}, Dates.DatePart{Char(0x73000000)}}}}})
precompile(Tuple{Type{Base.Iterators.Zip{Is} where Is<:Tuple}, Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64}}})
precompile(Tuple{typeof(Base.map), getfield(Base.Iterators, Symbol("#3#4")), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64}}})
precompile(Tuple{typeof(Base.Iterators._zip_iterate_all), Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64}}, Tuple{Tuple{}, Tuple{}}})
precompile(Tuple{typeof(Base.iterate), Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Tuple{Int64, Int64, Int64, Int64}}}, Tuple{Int64, Int64}})
precompile(Tuple{getfield(Base, Symbol("##chop#325")), Int64, Int64, typeof(Base.chop), String})
precompile(Tuple{Type{Base.SubString{T} where T<:AbstractString}, Base.SubString{String}})
precompile(Tuple{typeof(Base.nextind), Base.SubString{String}, Int64, Int64})
precompile(Tuple{getfield(Base, Symbol("##chop#325")), Int64, Int64, typeof(Base.chop), Base.SubString{String}})
precompile(Tuple{typeof(Parsers.codes), Int16})
precompile(Tuple{typeof(CSV.fatalerror), Array{UInt8, 1}, Int64, Int64, Int16, Int64, Int64})
precompile(Tuple{typeof(CSV.reallocatetape), Int64, Int64, Int64})
precompile(Tuple{getfield(Mmap, Symbol("##mmap#1")), Bool, Bool, typeof(Mmap.mmap), Mmap.Anonymous, Type{Array{UInt64, 1}}, Tuple{Int64}, Int64})
precompile(Tuple{typeof(CSV.notenoughcolumns), Int64, Int64, Int64})
precompile(Tuple{typeof(CSV.toomanycolumns), Int64, Int64})
precompile(Tuple{typeof(Base.ht_keyindex), Base.Dict{Int8, Int8}, Int8})
precompile(Tuple{Type{Base.Dict{String, UInt64}}})
precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{String, UInt64}, CSV.PointerString})
precompile(Tuple{typeof(Dates.validargs), Type{Dates.Time}, Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM})
precompile(Tuple{Type{Dates.Time}, Int64, Int64, Int64, Int64, Int64, Int64, Dates.AMPM})
precompile(Tuple{typeof(Parsers.BigInt!), Base.GMP.BigInt, Int64})
precompile(Tuple{Type{Float64}, Base.GMP.BigInt, Base.Rounding.RoundingMode{:Nearest}})
precompile(Tuple{typeof(Parsers.roundQuotient), Base.GMP.BigInt, Base.GMP.BigInt})
precompile(Tuple{typeof(Base.exp2), Base.MPFR.BigFloat})
precompile(Tuple{typeof(Base.:(*)), Base.MPFR.BigFloat, Base.MPFR.BigFloat})
precompile(Tuple{typeof(Parsers.scale), Type{Float64}, Int64, Int64})
precompile(Tuple{typeof(Core.throw_inexacterror), Symbol, Type{Int32}, Int128})
precompile(Tuple{typeof(Parsers.BigInt!), Base.GMP.BigInt, Int128})
precompile(Tuple{typeof(Parsers.scale), Type{Float64}, Int128, Int64})
precompile(Tuple{typeof(Base.Math.ldexp), Float64, Int128})
precompile(Tuple{Type{Base.GMP.BigInt}, Int128})
precompile(Tuple{typeof(Parsers.scale), Type{Float64}, Int128, Int128})
precompile(Tuple{typeof(Base.GMP.MPZ.add_ui), Base.GMP.BigInt, UInt8})
precompile(Tuple{typeof(Parsers.scale), Type{Float64}, Base.GMP.BigInt, Int64})
precompile(Tuple{typeof(Parsers.pow10), Type{Float64}, Base.GMP.BigInt})
precompile(Tuple{typeof(Base.Math.ldexp), Float64, Base.GMP.BigInt})
precompile(Tuple{typeof(Parsers.scale), Type{Float64}, Base.GMP.BigInt, Base.GMP.BigInt})
precompile(Tuple{typeof(Parsers._typeparser), Type{Float64}, Array{UInt8, 1}, Int64, Int64, UInt8, Int16, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Type{Base.GMP.BigInt}})
precompile(Tuple{typeof(Parsers._typeparser), Type{Float64}, Array{UInt8, 1}, Int64, Int64, UInt8, Int16, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Type{Int128}})
precompile(Tuple{typeof(CSV.detect), Array{UInt64, 1}, Array{UInt8, 1}, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64, Int64, Base.Dict{Int8, Int8}, Float64, Array{Base.Dict{String, UInt64}, 1}, Array{UInt64, 1}, Array{Int64, 1}, Bool, Array{Int8, 1}, Bool, Array{Array{UInt64, 1}, 1}})
precompile(Tuple{typeof(CSV.parsevalue!), Type{Float64}, Int8, Array{UInt64, 1}, Array{UInt8, 1}, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64, Int64, Array{Int8, 1}, Array{Array{UInt64, 1}, 1}})
precompile(Tuple{typeof(CSV.parsevalue!), Type{Dates.Date}, Int8, Array{UInt64, 1}, Array{UInt8, 1}, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64, Int64, Array{Int8, 1}, Array{Array{UInt64, 1}, 1}})
precompile(Tuple{typeof(CSV.parsevalue!), Type{Dates.DateTime}, Int8, Array{UInt64, 1}, Array{UInt8, 1}, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64, Int64, Array{Int8, 1}, Array{Array{UInt64, 1}, 1}})
precompile(Tuple{typeof(CSV.parsevalue!), Type{Dates.Time}, Int8, Array{UInt64, 1}, Array{UInt8, 1}, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64, Int64, Array{Int8, 1}, Array{Array{UInt64, 1}, 1}})
precompile(Tuple{typeof(CSV.parsevalue!), Type{Bool}, Int8, Array{UInt64, 1}, Array{UInt8, 1}, Int64, Int64, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Int64, Int64, Array{Int8, 1}, Array{Array{UInt64, 1}, 1}})
precompile(Tuple{typeof(CSV.parsetape), Base.Val{false}, Bool, Int64, Base.Dict{Int8, Int8}, Array{Array{UInt64, 1}, 1}, Array{Array{UInt64, 1}, 1}, Array{UInt8, 1}, Int64, Int64, Int64, Nothing, Array{Int64, 1}, Float64, Array{Base.Dict{String, UInt64}, 1}, Array{UInt64, 1}, Int64, Array{Int8, 1}, Array{Int64, 1}, Bool, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Bool})
precompile(Tuple{getfield(CSV, Symbol("#34#37")){Array{Int8, 1}, Array{UInt8, 1}, Parsers.Options{false, false, true, false, Base.Missing, UInt8, Nothing}, Float64, Int64, Bool, Base.Dict{Int8, Int8}, Int64, Nothing, Bool, Int64, Array{Int64, 1}, Int64, Array{Int64, 1}, Array{Array{Array{UInt64, 1}, 1}, 1}, Array{Array{Array{UInt64, 1}, 1}, 1}, Array{Array{Base.Dict{String, UInt64}, 1}, 1}, Array{Array{UInt64, 1}, 1}, Array{Array{Int8, 1}, 1}, Array{Array{Int64, 1}, 1}, Int64}})
precompile(Tuple{typeof(Base.task_done_hook), Task})
precompile(Tuple{typeof(Base.sum), Array{Int64, 1}})
precompile(Tuple{typeof(CSV._eltype), Type{Int64}})
precompile(Tuple{typeof(Base.getindex), Array{Array{Array{UInt64, 1}, 1}, 1}, Int64})
precompile(Tuple{typeof(Base.getindex), Array{Array{UInt64, 1}, 1}, Int64})
precompile(Tuple{typeof(Base.getindex), Array{Int64, 1}, Int64})
precompile(Tuple{typeof(CSV.uint64), Int64})
precompile(Tuple{Type{CSV.Column{Int64, Int64}}, Array{UInt64, 1}, Int64, UInt8, Bool, Nothing, Array{UInt8, 1}, UInt64})
precompile(Tuple{typeof(Base._array_for), Type{CSV.Column{Int64, Int64}}, Base.UnitRange{Int64}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{CSV.Column{Int64, Int64}, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{CSV.Column{Int64, Int64}, 1}, CSV.Column{Int64, Int64}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64})
precompile(Tuple{Type{CSV.Column2{Int64, Int64}}, Array{CSV.Column{Int64, Int64}, 1}, Int64})
precompile(Tuple{typeof(CSV._eltype), Type{String}})
precompile(Tuple{typeof(Base.nonmissingtype), Type{String}})
precompile(Tuple{typeof(CSV.sentinelvalue), Type{String}})
precompile(Tuple{Type{CSV.Column{String, String}}, Array{UInt64, 1}, Int64, UInt8, Bool, Nothing, Array{UInt8, 1}, UInt64})
precompile(Tuple{typeof(Base._array_for), Type{CSV.Column{String, String}}, Base.UnitRange{Int64}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{CSV.Column{String, String}, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{CSV.Column{String, String}, 1}, CSV.Column{String, String}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64})
precompile(Tuple{Type{CSV.Column2{String, String}}, Array{CSV.Column{String, String}, 1}, Int64})
precompile(Tuple{typeof(Base.nonmissingtype), Type{CSV.PooledString}})
precompile(Tuple{typeof(CSV.sentinelvalue), Type{CSV.PooledString}})
precompile(Tuple{Type{CSV.Column{String, CSV.PooledString}}, Array{UInt64, 1}, Int64, UInt8, Bool, Array{String, 1}, Array{UInt8, 1}, UInt64})
precompile(Tuple{typeof(Base._array_for), Type{CSV.Column{String, CSV.PooledString}}, Base.UnitRange{Int64}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{CSV.Column{String, CSV.PooledString}, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{CSV.Column{String, CSV.PooledString}, 1}, CSV.Column{String, CSV.PooledString}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64})
precompile(Tuple{Type{CSV.Column2{String, CSV.PooledString}}, Array{CSV.Column{String, CSV.PooledString}, 1}, Int64})
precompile(Tuple{typeof(CSV._eltype), Type{Float64}})
precompile(Tuple{typeof(Base.nonmissingtype), Type{Float64}})
precompile(Tuple{Type{CSV.Column{Float64, Float64}}, Array{UInt64, 1}, Int64, UInt8, Bool, Nothing, Array{UInt8, 1}, UInt64})
precompile(Tuple{typeof(Base._array_for), Type{CSV.Column{Float64, Float64}}, Base.UnitRange{Int64}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{CSV.Column{Float64, Float64}, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{CSV.Column{Float64, Float64}, 1}, CSV.Column{Float64, Float64}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64})
precompile(Tuple{Type{CSV.Column2{Float64, Float64}}, Array{CSV.Column{Float64, Float64}, 1}, Int64})
precompile(Tuple{typeof(CSV._eltype), Type{Union{Base.Missing, Float64}}})
precompile(Tuple{typeof(Base.nonmissingtype), Type{Union{Base.Missing, Float64}}})
precompile(Tuple{Type{CSV.Column{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}}, Array{UInt64, 1}, Int64, UInt8, Bool, Nothing, Array{UInt8, 1}, UInt64})
precompile(Tuple{typeof(Base._array_for), Type{CSV.Column{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}}, Base.UnitRange{Int64}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{CSV.Column{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{CSV.Column{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}, 1}, CSV.Column{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64})
precompile(Tuple{Type{CSV.Column2{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}}, Array{CSV.Column{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}, 1}, Int64})
precompile(Tuple{typeof(CSV._eltype), Type{Base.Missing}})
precompile(Tuple{typeof(Base.nonmissingtype), Type{Base.Missing}})
precompile(Tuple{typeof(CSV.sentinelvalue), Type{Union{}}})
precompile(Tuple{Type{CSV.Column{Base.Missing, Base.Missing}}, Array{UInt64, 1}, Int64, UInt8, Bool, Nothing, Array{UInt8, 1}, UInt64})
precompile(Tuple{typeof(Base._array_for), Type{CSV.Column{Base.Missing, Base.Missing}}, Base.UnitRange{Int64}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{CSV.Column{Base.Missing, Base.Missing}, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{CSV.Column{Base.Missing, Base.Missing}, 1}, CSV.Column{Base.Missing, Base.Missing}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64})
precompile(Tuple{Type{CSV.Column2{Base.Missing, Base.Missing}}, Array{CSV.Column{Base.Missing, Base.Missing}, 1}, Int64})
precompile(Tuple{typeof(CSV._eltype), Type{Dates.Date}})
precompile(Tuple{typeof(Base.nonmissingtype), Type{Dates.Date}})
precompile(Tuple{Type{CSV.Column{Dates.Date, Dates.Date}}, Array{UInt64, 1}, Int64, UInt8, Bool, Nothing, Array{UInt8, 1}, UInt64})
precompile(Tuple{typeof(Base._array_for), Type{CSV.Column{Dates.Date, Dates.Date}}, Base.UnitRange{Int64}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{CSV.Column{Dates.Date, Dates.Date}, 1}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{CSV.Column{Dates.Date, Dates.Date}, 1}, CSV.Column{Dates.Date, Dates.Date}, Base.Generator{Base.UnitRange{Int64}, getfield(CSV, Symbol("#22#30")){Array{UInt8, 1}, UInt8, Array{Type, 1}, Array{Union{Nothing, Array{String, 1}}, 1}, Int64}}, Int64})
precompile(Tuple{Type{CSV.Column2{Dates.Date, Dates.Date}}, Array{CSV.Column{Dates.Date, Dates.Date}, 1}, Int64})
precompile(Tuple{getfield(CSV, Symbol("#23#31")), Tuple{Symbol, CSV.Column2{Int64, Int64}}})
precompile(Tuple{Type{Base.Dict{Symbol, CSV.Column2{Int64, Int64}}}})
precompile(Tuple{typeof(Base.empty), Base.Dict{Any, Any}, Type{Symbol}, Type{CSV.Column2{Int64, Int64}}})
precompile(Tuple{typeof(Base.rehash!), Base.Dict{Symbol, CSV.Column2{Int64, Int64}}, Int64})
precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{Symbol, CSV.Column2{Int64, Int64}}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, CSV.Column2{Int64, Int64}}, CSV.Column2{Int64, Int64}, Symbol})
precompile(Tuple{typeof(Base.grow_to!), Base.Dict{Symbol, CSV.Column2{Int64, Int64}}, Base.Generator{Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}}}, getfield(CSV, Symbol("#23#31"))}, Tuple{Int64, Int64}})
precompile(Tuple{getfield(CSV, Symbol("#23#31")), Tuple{Symbol, CSV.Column2{String, String}}})
precompile(Tuple{Type{Base.Dict{Symbol, CSV.Column2{T, P} where P where T}}})
precompile(Tuple{typeof(Base.empty), Base.Dict{Symbol, CSV.Column2{Int64, Int64}}, Type{Symbol}, Type{CSV.Column2{T, P} where P where T}})
precompile(Tuple{typeof(Base.rehash!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, Int64})
precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, CSV.Column2{Int64, Int64}, Symbol})
precompile(Tuple{typeof(Base.merge!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, Base.Dict{Symbol, CSV.Column2{Int64, Int64}}})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, CSV.Column2{String, String}, Symbol})
precompile(Tuple{typeof(Base.grow_to!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, Base.Generator{Base.Iterators.Zip{Tuple{Array{Symbol, 1}, Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}}}, getfield(CSV, Symbol("#23#31"))}, Tuple{Int64, Int64}})
precompile(Tuple{getfield(CSV, Symbol("#23#31")), Tuple{Symbol, CSV.Column2{String, CSV.PooledString}}})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, CSV.Column2{String, CSV.PooledString}, Symbol})
precompile(Tuple{getfield(CSV, Symbol("#23#31")), Tuple{Symbol, CSV.Column2{Float64, Float64}}})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, CSV.Column2{Float64, Float64}, Symbol})
precompile(Tuple{getfield(CSV, Symbol("#23#31")), Tuple{Symbol, CSV.Column2{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}}})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, CSV.Column2{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}, Symbol})
precompile(Tuple{getfield(CSV, Symbol("#23#31")), Tuple{Symbol, CSV.Column2{Base.Missing, Base.Missing}}})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, CSV.Column2{Base.Missing, Base.Missing}, Symbol})
precompile(Tuple{getfield(CSV, Symbol("#23#31")), Tuple{Symbol, CSV.Column2{Dates.Date, Dates.Date}}})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, CSV.Column2{T, P} where P where T}, CSV.Column2{Dates.Date, Dates.Date}, Symbol})
precompile(Tuple{typeof(Base.show), Base.GenericIOBuffer{Array{UInt8, 1}}, Type})
precompile(Tuple{typeof(Base.show), Base.GenericIOBuffer{Array{UInt8, 1}}, Int64})
precompile(Tuple{typeof(Base.show), Base.GenericIOBuffer{Array{UInt8, 1}}, Bool})
precompile(Tuple{Type{Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}}})
precompile(Tuple{Type{Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}}, Base.Dict{Symbol, CSV.Column2{T, P} where P where T}})
precompile(Tuple{Type{CSV.File{true}}, String, Array{Symbol, 1}, Array{Type, 1}, Int64, Int64, Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}, Base.Dict{Symbol, CSV.Column2{T, P} where P where T}})
precompile(Tuple{typeof(Base.rehash!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, Int64})
precompile(Tuple{typeof(Base.ht_keyindex2!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, CSV.Column2{Base.Missing, Base.Missing}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, CSV.Column2{String, CSV.PooledString}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, CSV.Column2{Int64, Int64}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, CSV.Column2{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, CSV.Column2{Float64, Float64}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}, CSV.Column2{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}, CSV.Column2{String, CSV.PooledString}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}, CSV.Column2{Base.Missing, Base.Missing}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}, CSV.Column2{Float64, Float64}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}, 1}, CSV.Column2{Int64, Int64}, Int64})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, CSV.Column2{String, String}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Base.Dict{Symbol, Union{CSV.Column{T, P} where P where T, CSV.Column2{T, P} where P where T}}, CSV.Column2{Dates.Date, Dates.Date}, Symbol})
precompile(Tuple{typeof(Base.setindex!), Array{AbstractArray{T, 1} where T, 1}, CSV.Column2{Int64, Int64}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{AbstractArray{T, 1} where T, 1}, CSV.Column2{String, String}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{AbstractArray{T, 1} where T, 1}, CSV.Column2{String, CSV.PooledString}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{AbstractArray{T, 1} where T, 1}, CSV.Column2{Float64, Float64}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{AbstractArray{T, 1} where T, 1}, CSV.Column2{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{AbstractArray{T, 1} where T, 1}, CSV.Column2{Base.Missing, Base.Missing}, Int64})
precompile(Tuple{typeof(Base.setindex!), Array{AbstractArray{T, 1} where T, 1}, CSV.Column2{Dates.Date, Dates.Date}, Int64})
precompile(Tuple{getfield(DataFrames, Symbol("#94#97")), CSV.Column2{Int64, Int64}})
precompile(Tuple{typeof(Base._array_for), Type{Int64}, Array{AbstractArray{T, 1} where T, 1}, Base.HasShape{1}})
precompile(Tuple{typeof(Base.collect_to!), Array{Int64, 1}, Base.Generator{Array{AbstractArray{T, 1} where T, 1}, getfield(DataFrames, Symbol("#94#97"))}, Int64, Int64})
precompile(Tuple{typeof(Base.collect_to_with_first!), Array{Int64, 1}, Int64, Base.Generator{Array{AbstractArray{T, 1} where T, 1}, getfield(DataFrames, Symbol("#94#97"))}, Int64})
precompile(Tuple{getfield(DataFrames, Symbol("#94#97")), CSV.Column2{String, String}})
precompile(Tuple{getfield(DataFrames, Symbol("#94#97")), CSV.Column2{String, CSV.PooledString}})
precompile(Tuple{getfield(DataFrames, Symbol("#94#97")), CSV.Column2{Float64, Float64}})
precompile(Tuple{getfield(DataFrames, Symbol("#94#97")), CSV.Column2{Union{Base.Missing, Float64}, Union{Base.Missing, Float64}}})
precompile(Tuple{getfield(DataFrames, Symbol("#94#97")), CSV.Column2{Base.Missing, Base.Missing}})
precompile(Tuple{getfield(DataFrames, Symbol("#94#97")), CSV.Column2{Dates.Date, Dates.Date}})
precompile(Tuple{typeof(Base.extrema), Array{Int64, 1}})
precompile(Tuple{typeof(Base.println), Base.TTY, String, Vararg{Any, N} where N})
precompile(Tuple{typeof(Base.print), Base.TTY, String, Int64, Vararg{Any, N} where N})
precompile(Tuple{typeof(Base.print), Base.TTY, Int64})
precompile(Tuple{typeof(Base.length), CSV.Column2{Int64, Int64}})
precompile(Tuple{typeof(Base.print), Base.TTY, String, Tuple{Int64, Int64}, Vararg{Any, N} where N})
precompile(Tuple{typeof(Base.show_delim_array), Base.TTY, Tuple{Int64, Int64}, Char, Char, Char, Bool, Int64, Int64})
precompile(Tuple{typeof(Base.print), Base.TTY, Tuple{Int64, Int64}})
precompile(Tuple{typeof(Base._atexit)})
precompile(Tuple{getfield(Base.Filesystem, Symbol("#rm##kw")), NamedTuple{(:force, :recursive), Tuple{Bool, Bool}}, typeof(Base.Filesystem.rm), String})
precompile(Tuple{getfield(Base.Filesystem, Symbol("##rm#9")), Bool, Bool, typeof(Base.Filesystem.rm), String})
precompile(Tuple{typeof(Base.Filesystem.temp_cleanup_purge), Bool})
precompile(Tuple{typeof(Base.Filesystem.temp_cleanup_purge)})

max_stars_repo_name: xiaodaigh/csv-to-parquet

max_issues_repo_name: xiaodaigh/csv-to-parquet

max_forks_repo_name: xiaodaigh/csv-to-parquet


text:
mutable struct six_axis_force_torque_t <: LCMType
    utime::Int64
    force::SVector{3, Float64}
    moment::SVector{3, Float64}
end

@lcmtypesetup(six_axis_force_torque_t)


text:
"""
    Num(val)

Wrap anything in a type that is a subtype of Real
"""
struct Num <: Real
    val
end

const show_numwrap = Ref(false)

Num(x::Num) = x # ideally this should never be called
(n::Num)(args...) = Num(value(n)(map(value,args)...))
value(x) = x
value(x::Num) = x.val

using SymbolicUtils: to_symbolic
SymbolicUtils.to_symbolic(n::Num) = value(n)
SymbolicUtils.@number_methods(Num,
                              Num(f(value(a))),
                              Num(f(value(a), value(b))))

SymbolicUtils.simplify(n::Num; kw...) = Num(SymbolicUtils.simplify(value(n); kw...))

SymbolicUtils.symtype(n::Num) = symtype(n.val)

function Base.iszero(x::Num)
    _x = SymbolicUtils.to_mpoly(value(x))[1]
    return (_x isa Number || _x isa SymbolicUtils.MPoly) && iszero(_x)
end

import SymbolicUtils: <ₑ, Symbolic, Term, operation, arguments

Base.show(io::IO, n::Num) = show_numwrap[] ? print(io, :(Num($(value(n))))) : Base.show(io, value(n))

Base.promote_rule(::Type{<:Number}, ::Type{<:Num}) = Num
Base.promote_rule(::Type{<:Symbolic{<:Number}}, ::Type{<:Num}) = Num
function Base.getproperty(t::Union{Add, Mul, Pow, Term}, f::Symbol)
    if f === :op
        Base.depwarn("`x.op` is deprecated, use `operation(x)` instead", :getproperty, force=true)
        operation(t)
    elseif f === :args
        Base.depwarn("`x.args` is deprecated, use `arguments(x)` instead", :getproperty, force=true)
        arguments(t)
    else
        getfield(t, f)
    end
end
<ₑ(s::Num, x) = value(s) <ₑ value(x)
<ₑ(s, x::Num) = value(s) <ₑ value(x)
<ₑ(s::Num, x::Num) = value(s) <ₑ value(x)

for T in (Integer, Rational)
    @eval Base.:(^)(n::Num, i::$T) = Num(value(n)^i)
end

macro num_method(f, expr, Ts=nothing)
    if Ts === nothing
        Ts = [Any]
    else
        @assert Ts.head == :tuple
        # e.g. a tuple or vector
        Ts = Ts.args
    end

    ms = [quote
              $f(a::$T, b::$Num) = $expr
              $f(a::$Num, b::$T) = $expr
          end for T in Ts]
    quote
        $f(a::$Num, b::$Num) = $expr
        $(ms...)
    end |> esc
end

"""
    tosymbolic(a::Union{Sym,Num}) -> Sym{Real}
    tosymbolic(a::T) -> T
"""
tosymbolic(a::Num) = tosymbolic(value(a))
tosymbolic(a::Sym) = Sym{symtype(a)}(nameof(a)) # unwrap stuff like Parameter{<:Number}
tosymbolic(a) = a

@num_method Base.isless isless(tosymbolic(a), tosymbolic(b)) (Real,)
@num_method Base.:(<) (tosymbolic(a) < tosymbolic(b)) (Real,)
@num_method Base.:(<=) (tosymbolic(a) <= tosymbolic(b)) (Real,)
@num_method Base.:(>) (tosymbolic(a) > tosymbolic(b)) (Real,)
@num_method Base.:(>=) (tosymbolic(a) >= tosymbolic(b)) (Real,)
@num_method Base.isequal isequal(tosymbolic(a), tosymbolic(b)) (AbstractFloat, Number, Symbolic)
@num_method Base.:(==) tosymbolic(a) == tosymbolic(b) (AbstractFloat,Number)

Base.hash(x::Num, h::UInt) = hash(value(x), h)

Base.convert(::Type{Num}, x::Symbolic{<:Number}) = Num(x)
Base.convert(::Type{Num}, x::Number) = Num(x)
Base.convert(::Type{Num}, x::Num) = x

Base.convert(::Type{<:Array{Num}}, x::AbstractArray) = map(Num, x)
Base.convert(::Type{<:Array{Num}}, x::AbstractArray{Num}) = x
Base.convert(::Type{Sym}, x::Num) = value(x) isa Sym ? value(x) : error("cannot convert $x to Sym")

LinearAlgebra.lu(x::Array{Num}; check=true, kw...) = sym_lu(x; check=check)

_iszero(x::Number) = iszero(x)
_isone(x::Number) = isone(x)
_iszero(::Symbolic) = false
_isone(::Symbolic) = false
_iszero(x::Num) = _iszero(value(x))
_isone(x::Num) = _isone(value(x))


text:
###############################################################################

function newmutationssample(cancercell, μ, mutID)

    #function to add new mutations to cells based on μ

    if μ == 0.0
      return cancercell,mutID
    end

    numbermutations = rand(Poisson(μ))

    cancercell.mutations = append!(cancercell.mutations, mutID:mutID+numbermutations-1)
    mutID = mutID + numbermutations

    return cancercell, mutID
end

function newmutationsinitsample(cancercell, clonalmutations, mutID)

    numbermutations = clonalmutations

    cancercell.mutations = append!(cancercell.mutations,mutID:mutID+numbermutations-1)
    mutID = mutID + numbermutations

    return cancercell, mutID
end

function initializesimsample(clonalmutations)

    #initialize empty arrays and first cell with clonal mutations

    #initialize time to zero
    t = 0.0
    tvec = Float64[]
    push!(tvec,t)

    #population starts with one cell
    N = 1
    Nvec = Int64[]
    push!(Nvec,N)

    #Initialize array of cell type that stores mutations for each cell and their fitness type
    #fitness type of 1 is the host population, lowest fitness
    cells = cancercell[]
    push!(cells,cancercell([],1))

    #need to keep track of mutations, assuming infinite sites, new mutations will be unique,
    #we assign each new muation with a unique integer by simply counting up from one

    mutID = 1

    cells[1],mutID = newmutationsinitsample(cells[1],clonalmutations,mutID)

    return t,tvec,N,Nvec,cells,mutID
end

function tumourgrow_birthdeathsample(b, d, Nmax, μ; numclones=1, clonalmutations = 0, s = [0.0], tevent=[0.0], maxclonefreq = 100)

    #set array of birthrates
    birthrates = [b]
    deathrates = [d]

    times = vcat(tevent, 0.0)

    #map!(x->log(1+x)/(b-d),s)

    #depending on number of clones add birthrates to model
    for i in 1:numclones
        push!(deathrates, rand() * deathrates[1])
        push!(birthrates,(1 + s[i]) * (birthrates[1] - deathrates[1]) + deathrates[i + 1])
    end

    #Rmax starts with b + d and changes once a fitter mutant is introduced, this ensures that
    # b and d have correct units
    Rmax = b + d

    #initialize arrays and parameters
    t,tvec,N,Nvec,cells,mutID = initializesimsample(clonalmutations)
    muts = Int64[]
    push!(muts,mutID)

    #we only want to introduce mutant once so have variable that keeps track of how many mutants have been introduced, keep track of which type of which clone aquires new clone
    fitmutant = 1
    clonetype = Int64[]
    clonetime = Float64[]
    subclonemutations = Any[]
    cloneN = Int64[]
    Ndivisions = Int64[]

    clonefreq = zeros(Int64, numclones + 1)
    clonefreq[1] = 1

    executed = false

    changemutrate = broadcast(!, BitArray(numclones + 1))

    while N < Nmax

        #pick a random cell
        randcell = rand(1:N)

        r = rand(Uniform(0,Rmax))

        #println([r, Rmax, (birthrates[cells[randcell].fitness] + deathrates[cells[randcell].fitness]), randcell])

	      Nt = N

        #birth event if r<birthrate, access correct birthrate from cells array
        if r < birthrates[cells[randcell].fitness]

            #population increases by one
            N = N + 1

            #copy cell and mutations for cell that reproduces
            push!(cells,deepcopy(cells[randcell]))

            #add new mutations to both new cells
            cells[randcell],mutID = newmutationssample(cells[randcell],μ,mutID)
            cells[end],mutID = newmutationssample(cells[end],μ,mutID)

            push!(muts,mutID)

            clonefreq[cells[randcell].fitness] = clonefreq[cells[randcell].fitness] + 1

            push!(Nvec, N)

            Δt =  - 1/(Rmax * Nt) * log(rand())

            t = t + Δt

            push!(tvec,t)

            #if population time is tevent, cell is mutated into fitter cell
            if t > times[fitmutant]
                if fitmutant != numclones + 1
                    #one mutant turns into another "type" so decreases in frequency

                    clonefreq[cells[randcell].fitness] = clonefreq[cells[randcell].fitness] - 1

                    #keep track of how many clones
                    fitmutant += 1

                    push!(clonetype, cells[randcell].fitness)

                    #change one mutant to fitter mutant
                    cells[randcell].fitness = fitmutant

                    #new type increases in frequency
                    clonefreq[cells[randcell].fitness] = clonefreq[cells[randcell].fitness] + 1

                    #change Rmax given that we now have a new fitter mutant
                    Rmax = maximum(birthrates[1:fitmutant]) + maximum(deathrates[1:fitmutant])

                    push!(clonetime, t)
                    push!(subclonemutations, deepcopy(cells[randcell].mutations))
                    push!(cloneN, N)
                    push!(Ndivisions, length(cells[randcell].mutations))

                end
            end

        end

        if (birthrates[cells[randcell].fitness] + deathrates[cells[randcell].fitness]) <= r

          push!(Nvec, N)
          Δt =  - 1/(Rmax * Nt) * log(rand())
          t = t + Δt
          push!(tvec,t)
        end

        #death event if b<r<b+d
        if (birthrates[cells[randcell].fitness] <= r < birthrates[cells[randcell].fitness] + deathrates[cells[randcell].fitness])

            #population decreases by 1
            N = N - 1

            #frequency of cell type decreases
            clonefreq[cells[randcell].fitness] = clonefreq[cells[randcell].fitness] - 1

            #remove deleted cell
            deleteat!(cells,randcell)

            push!(Nvec,N)

            Δt =  - 1/(Rmax * Nt) * log(rand())

            t = t + Δt

            push!(tvec,t)

        end

        #every cell dies reinitialize simulation
        if (N == 0)
            t,tvec,N,Nvec,cells,mutID = initializesim(clonalmutations)
            muts = Int64[]
            push!(muts,mutID)
        end

        if (executed == false) && ((clonefreq.>maxclonefreq) == changemutrate)
            μ = 0.0
            executed = true
        end

    end

    return RawOutput(Nvec, tvec, muts, cells, birthrates, deathrates, clonetype, clonetime, subclonemutations, cloneN, Ndivisions)
end

###############################################################################