text:
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.

struct PublicIPAddressesApi <: SwaggerApi
    client::Swagger.Client
end

"""

Creates or updates a static or dynamic public IP address.
Param: resourceGroupName::String (required)
Param: publicIpAddressName::String (required)
Param: parameters::PublicIPAddress (required)
Param: api_version::String (required)
Param: subscriptionId::String (required)
Return: PublicIPAddress
"""
function _swaggerinternal_publicIPAddressesCreateOrUpdate(_api::PublicIPAddressesApi, resourceGroupName::String, publicIpAddressName::String, parameters, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = Swagger.Ctx(_api.client, "PUT", PublicIPAddress, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", ["azure_auth"], parameters)
    Swagger.set_param(_ctx.path, "resourceGroupName", resourceGroupName)  # type String
    Swagger.set_param(_ctx.path, "publicIpAddressName", publicIpAddressName)  # type String
    Swagger.set_param(_ctx.path, "subscriptionId", subscriptionId)  # type String
    Swagger.set_param(_ctx.query, "api-version", api_version)  # type String
    Swagger.set_header_accept(_ctx, ["application/json"])
    Swagger.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json"] : [_mediaType])
    return _ctx
end

function publicIPAddressesCreateOrUpdate(_api::PublicIPAddressesApi, resourceGroupName::String, publicIpAddressName::String, parameters, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesCreateOrUpdate(_api, resourceGroupName, publicIpAddressName, parameters, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx)
end

function publicIPAddressesCreateOrUpdate(_api::PublicIPAddressesApi, response_stream::Channel, resourceGroupName::String, publicIpAddressName::String, parameters, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesCreateOrUpdate(_api, resourceGroupName, publicIpAddressName, parameters, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx, response_stream)
end

"""

Deletes the specified public IP address.
Param: resourceGroupName::String (required)
Param: publicIpAddressName::String (required)
Param: api_version::String (required)
Param: subscriptionId::String (required)
Return: Nothing
"""
function _swaggerinternal_publicIPAddressesDelete(_api::PublicIPAddressesApi, resourceGroupName::String, publicIpAddressName::String, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = Swagger.Ctx(_api.client, "DELETE", Nothing, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", ["azure_auth"])
    Swagger.set_param(_ctx.path, "resourceGroupName", resourceGroupName)  # type String
    Swagger.set_param(_ctx.path, "publicIpAddressName", publicIpAddressName)  # type String
    Swagger.set_param(_ctx.path, "subscriptionId", subscriptionId)  # type String
    Swagger.set_param(_ctx.query, "api-version", api_version)  # type String
    Swagger.set_header_accept(_ctx, ["application/json"])
    Swagger.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json"] : [_mediaType])
    return _ctx
end

function publicIPAddressesDelete(_api::PublicIPAddressesApi, resourceGroupName::String, publicIpAddressName::String, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesDelete(_api, resourceGroupName, publicIpAddressName, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx)
end

function publicIPAddressesDelete(_api::PublicIPAddressesApi, response_stream::Channel, resourceGroupName::String, publicIpAddressName::String, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesDelete(_api, resourceGroupName, publicIpAddressName, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx, response_stream)
end

"""

Gets the specified public IP address in a specified resource group.
Param: resourceGroupName::String (required)
Param: publicIpAddressName::String (required)
Param: api_version::String (required)
Param: subscriptionId::String (required)
Param: expand::String
Return: PublicIPAddress
"""
function _swaggerinternal_publicIPAddressesGet(_api::PublicIPAddressesApi, resourceGroupName::String, publicIpAddressName::String, api_version::String, subscriptionId::String; expand=nothing, _mediaType=nothing)
    _ctx = Swagger.Ctx(_api.client, "GET", PublicIPAddress, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", ["azure_auth"])
    Swagger.set_param(_ctx.path, "resourceGroupName", resourceGroupName)  # type String
    Swagger.set_param(_ctx.path, "publicIpAddressName", publicIpAddressName)  # type String
    Swagger.set_param(_ctx.path, "subscriptionId", subscriptionId)  # type String
    Swagger.set_param(_ctx.query, "api-version", api_version)  # type String
    Swagger.set_param(_ctx.query, "\$expand", expand)  # type String
    Swagger.set_header_accept(_ctx, ["application/json"])
    Swagger.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json"] : [_mediaType])
    return _ctx
end

function publicIPAddressesGet(_api::PublicIPAddressesApi, resourceGroupName::String, publicIpAddressName::String, api_version::String, subscriptionId::String; expand=nothing, _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesGet(_api, resourceGroupName, publicIpAddressName, api_version, subscriptionId; expand=expand, _mediaType=_mediaType)
    Swagger.exec(_ctx)
end

function publicIPAddressesGet(_api::PublicIPAddressesApi, response_stream::Channel, resourceGroupName::String, publicIpAddressName::String, api_version::String, subscriptionId::String; expand=nothing, _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesGet(_api, resourceGroupName, publicIpAddressName, api_version, subscriptionId; expand=expand, _mediaType=_mediaType)
    Swagger.exec(_ctx, response_stream)
end

"""

Gets all public IP addresses in a resource group.
Param: resourceGroupName::String (required)
Param: api_version::String (required)
Param: subscriptionId::String (required)
Return: PublicIPAddressListResult
"""
function _swaggerinternal_publicIPAddressesList(_api::PublicIPAddressesApi, resourceGroupName::String, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = Swagger.Ctx(_api.client, "GET", PublicIPAddressListResult, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", ["azure_auth"])
    Swagger.set_param(_ctx.path, "resourceGroupName", resourceGroupName)  # type String
    Swagger.set_param(_ctx.path, "subscriptionId", subscriptionId)  # type String
    Swagger.set_param(_ctx.query, "api-version", api_version)  # type String
    Swagger.set_header_accept(_ctx, ["application/json"])
    Swagger.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json"] : [_mediaType])
    return _ctx
end

function publicIPAddressesList(_api::PublicIPAddressesApi, resourceGroupName::String, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesList(_api, resourceGroupName, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx)
end

function publicIPAddressesList(_api::PublicIPAddressesApi, response_stream::Channel, resourceGroupName::String, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesList(_api, resourceGroupName, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx, response_stream)
end

"""

Gets all the public IP addresses in a subscription.
Param: api_version::String (required)
Param: subscriptionId::String (required)
Return: PublicIPAddressListResult
"""
function _swaggerinternal_publicIPAddressesListAll(_api::PublicIPAddressesApi, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = Swagger.Ctx(_api.client, "GET", PublicIPAddressListResult, "/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses", ["azure_auth"])
    Swagger.set_param(_ctx.path, "subscriptionId", subscriptionId)  # type String
    Swagger.set_param(_ctx.query, "api-version", api_version)  # type String
    Swagger.set_header_accept(_ctx, ["application/json"])
    Swagger.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json"] : [_mediaType])
    return _ctx
end

function publicIPAddressesListAll(_api::PublicIPAddressesApi, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesListAll(_api, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx)
end

function publicIPAddressesListAll(_api::PublicIPAddressesApi, response_stream::Channel, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesListAll(_api, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx, response_stream)
end

"""

Updates public IP address tags.
Param: resourceGroupName::String (required)
Param: publicIpAddressName::String (required)
Param: parameters::TagsObject (required)
Param: api_version::String (required)
Param: subscriptionId::String (required)
Return: PublicIPAddress
"""
function _swaggerinternal_publicIPAddressesUpdateTags(_api::PublicIPAddressesApi, resourceGroupName::String, publicIpAddressName::String, parameters, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = Swagger.Ctx(_api.client, "PATCH", PublicIPAddress, "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", ["azure_auth"], parameters)
    Swagger.set_param(_ctx.path, "resourceGroupName", resourceGroupName)  # type String
    Swagger.set_param(_ctx.path, "publicIpAddressName", publicIpAddressName)  # type String
    Swagger.set_param(_ctx.path, "subscriptionId", subscriptionId)  # type String
    Swagger.set_param(_ctx.query, "api-version", api_version)  # type String
    Swagger.set_header_accept(_ctx, ["application/json"])
    Swagger.set_header_content_type(_ctx, (_mediaType === nothing) ? ["application/json"] : [_mediaType])
    return _ctx
end

function publicIPAddressesUpdateTags(_api::PublicIPAddressesApi, resourceGroupName::String, publicIpAddressName::String, parameters, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesUpdateTags(_api, resourceGroupName, publicIpAddressName, parameters, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx)
end

function publicIPAddressesUpdateTags(_api::PublicIPAddressesApi, response_stream::Channel, resourceGroupName::String, publicIpAddressName::String, parameters, api_version::String, subscriptionId::String; _mediaType=nothing)
    _ctx = _swaggerinternal_publicIPAddressesUpdateTags(_api, resourceGroupName, publicIpAddressName, parameters, api_version, subscriptionId; _mediaType=_mediaType)
    Swagger.exec(_ctx, response_stream)
end

export publicIPAddressesCreateOrUpdate, publicIPAddressesDelete, publicIPAddressesGet, publicIPAddressesList, publicIPAddressesListAll, publicIPAddressesUpdateTags


text:
# Find a way to run these example in isolation
using Finch

init_finch("poisson1d")

useLog("poisson1dlog")

domain(1)

functionSpace(order=3)
mesh(LINEMESH, elsperdim=20)

u = variable("u")
testSymbol("v")
boundary(u, 1, DIRICHLET, 0)

coefficient("f", "-100*pi*pi*sin(10*pi*x)*sin(pi*x) -
             pi*pi*sin(10*pi*x)*sin(pi*x) + 20*pi*pi*cos(10*pi*x)*cos(pi*x)")
weakForm(u, "-grad(u)*grad(v) - f*v")

import Finch: grid_data, mesh_data, refel
dofs_per_node = 1

N1 = size(grid_data.allnodes,2);
Nn = dofs_per_node * N1;
Np = refel.Np;
nel = mesh_data.nel;

rhsvec = zeros(Nn);
lhsmatI = zeros(Int, nel*dofs_per_node*Np*dofs_per_node*Np);
lhsmatJ = zeros(Int, nel*dofs_per_node*Np*dofs_per_node*Np);
lhsmatV = zeros(nel*dofs_per_node*Np*dofs_per_node*Np);
allocated_vecs = [rhsvec, lhsmatI, lhsmatJ, lhsmatV];

Finch.CGSolver.assemble(u, Finch.bilinears[u.index], Finch.linears[u.index], allocated_vecs)

print("END")

#SUITE["poisson1d-assemble"] = @benchmarkable Finch.CGSolver.assemble($u,
                         #$Finch.bilinears[u.index], $Finch.linears[u.index])

ext: jl

max_stars_repo_name: paralab/Finch

max_issues_repo_name: paralab/Finch

max_forks_repo_name: paralab/Finch


text:
#################################################################################################
# AIM 3
#################################################################################################
## Deps
using CodecZlib
using StatsPlots
using Distributions
using DelimitedFiles
using Plots.PlotMeasures

## Constants
const wgbs_dir = "/Users/jordiabante/OneDrive - Johns Hopkins/CpelNano/Data/Real-Data/Aim-3/wgbs/"
const nano_dir = "/Users/jordiabante/OneDrive - Johns Hopkins/CpelNano/Data/Real-Data/Aim-3/nanopore/"

## Default attributes
default(titlefont=(14, "arial"),guidefont=(16, "arial"),tickfont=(12, "arial"))

#################################################################################################
# Functions
#################################################################################################
function find_comm_regions(sts1::Vector{Int64}, sts2::Vector{Int64})::NTuple{2,Vector{Bool}}

    # Find common regions
    int_sts = intersect(Set(sts1), Set(sts2))
    sts1_ind = map(i -> sts1[i] in int_sts, 1:length(sts1))
    sts2_ind = map(i -> sts2[i] in int_sts, 1:length(sts2))

    # Return
    return sts1_ind, sts2_ind

end
function cos_sim(mat1::Array{Float64,2}, mat2::Array{Float64,2})::Vector{Float64}

    # Intermediate quantities
    num = sum(mat1 .* mat2, dims=2)
    den = sqrt.(sum(mat1.^2, dims=2)) .* sqrt.(sum(mat2.^2, dims=2))

    # Return cosine similarity
    return vec(num ./ den)

end
function read_in_model_file(path::String)::Tuple{Vector{Int64},Array{Float64,2}}

    # Get data
    stream = GzipDecompressorStream(open(path))
    in_data = readdlm(stream)
    close(stream)

    # Read in estimated regions and parameters
    cpel_reg = convert.(Int64, in_data[:,2])
    cpel_params = in_data[:,4]
    cpel_params = map(x -> parse.(Float64, split(x, ",")), cpel_params)

    # Get parameters
    a = map(x -> x[1], cpel_params)
    b = map(x -> x[2], cpel_params)
    c = map(x -> x[3], cpel_params)

    # Return vectors
    return cpel_reg, [a b c]

end
function read_in_ex_file(path::String)::Tuple{Vector{Int64},Vector{Float64}}

    # Get data
    stream = GzipDecompressorStream(open(path))
    in_data = readdlm(stream)
    close(stream)

    # Read in estimated regions and parameters
    cpel_reg = convert.(Int64, in_data[:,2])
    cpel_ex = convert.(Float64, in_data[:,4])

    # Return vectors
    return cpel_reg, cpel_ex

end
function read_in_exx_file(path::String)::Tuple{Vector{Int64},Vector{Float64}}

    # Get data
    stream = GzipDecompressorStream(open(path))
    in_data = readdlm(stream)
    close(stream)

    # Read in estimated regions and parameters
    cpel_cg1 = convert.(Int64, in_data[:,2])
    cpel_exx = convert.(Float64, in_data[:,4])

    # Return vectors
    return cpel_cg1, cpel_exx

end
function comp_eyy(ex_cg::Vector{Int64}, ex::Vector{Float64}, exx_cg1::Vector{Int64}, exx::Vector{Float64})::Vector{Float64}

    # Compute E[YnYn+1]
    eyy = fill(NaN, length(exx))
    @inbounds for n = 1:length(eyy)
        # Find corresponding CG sites
        cg1_ind = findfirst(isequal(exx_cg1[n]), ex_cg)
        isnothing(cg1_ind) && continue
        # E[YY] = 0.25 *(E[XnXn+1]+E[Xn]+E[Xn+1]+1)
        eyy[n] = 0.25 * (exx[n] + ex[cg1_ind] + ex[cg1_ind + 1] + 1.0)
    end

    # Return
    return min.(1.0, max.(0.0, eyy))

end
function plt_params_scatter()

    # Files
    gt_mod_file = "$(wgbs_dir)/GM12878_wgbs_cpelnano_theta.txt.gz"
    nano_file = "$(nano_dir)/gm12878_chr22_cpelnano_theta.txt.gz"

    # Params
    wgbs_sts, wgbs_params = read_in_model_file(gt_mod_file)
    nano_sts, nano_params = read_in_model_file(nano_file)

    # Find common regions
    wgbs_sts_ind, nano_sts_ind = find_comm_regions(wgbs_sts, nano_sts)
    wgbs_params = wgbs_params[wgbs_sts_ind,:]
    nano_params = nano_params[nano_sts_ind,:]

    # Plot scatter
    xlab = "Fine-grain (WGBS)"
    ylab = "Coarse-grain (Nanopore)"
    p_a = plot(wgbs_params[:,1],nano_params[:,1],seriestype=:scatter,ylabel=ylab,markersize=0.2,
        markeralpha=0.1,xlim=(-10.0, 10.0),ylim=(-10.0, 10.0),label="",title="a");
    p_b = plot(wgbs_params[:,2],nano_params[:,2],seriestype=:scatter,ylabel=ylab,markersize=0.2,
        markeralpha=0.1,xlim=(-100.0, 100.0),ylim=(-100.0, 100.0),label="",title="b");
    p_c = plot(wgbs_params[:,3],nano_params[:,3],seriestype=:scatter,xlabel=xlab,ylabel=ylab,
        markersize=0.2,markeralpha=0.1,xlim=(-20.0, 20.0),ylim=(-20.0, 20.0),label="",title="c");
    plot(p_a, p_b, p_c, layout=(3, 1), size=(500, 800))
    savefig("$(nano_dir)/Scatter-Params-Aim-3.pdf")
    savefig("$(nano_dir)/Scatter-Params-Aim-3.png")

    # Return nothing
    return nothing

end
function plt_exp_heatmap()

    # Ground-truth quantities
    gt_ex_file = "$(wgbs_dir)/GM12878_wgbs_cpelnano_theta_ex.txt.gz"
    gt_exx_file = "$(wgbs_dir)/GM12878_wgbs_cpelnano_theta_exx.txt.gz"
    gt_ex_sts, gt_ex = read_in_ex_file(gt_ex_file)
    gt_exx_sts, gt_exx = read_in_exx_file(gt_exx_file)
    gt_ey = 0.5 .* (gt_ex .+ 1.0)
    gt_eyy = comp_eyy(gt_ex_sts, gt_ex, gt_exx_sts, gt_exx)

    # Estimated quantities
    ex_file = "$(nano_dir)/gm12878_chr22_cpelnano_ex.txt.gz"
    exx_file = "$(nano_dir)/gm12878_chr22_cpelnano_exx.txt.gz"
    ex_sts, ex = read_in_ex_file(ex_file)
    exx_sts, exx = read_in_exx_file(exx_file)
    ey = 0.5 .* (ex .+ 1.0)
    eyy = comp_eyy(ex_sts, ex, exx_sts, exx)

    # Find common regions E[X]
    wgbs_sts_ex_ind, ex_sts_ind = find_comm_regions(gt_ex_sts, ex_sts)
    gt_ey = gt_ey[wgbs_sts_ex_ind]
    ey = ey[ex_sts_ind]

    # Find common regions E[XX]
    wgbs_sts_exx_ind, exx_sts_ind = find_comm_regions(gt_exx_sts, exx_sts)
    gt_eyy = gt_eyy[wgbs_sts_exx_ind]
    eyy = eyy[exx_sts_ind]

    # Construct matrix
    res_grid = 0.05
    axis_rng = collect(0:res_grid:1.0)
    mat_y = fill(0.0, (length(axis_rng) - 1, length(axis_rng) - 1))
    mat_yy = fill(0.0, (length(axis_rng) - 1, length(axis_rng) - 1))
    for i in (length(axis_rng) - 1):-1:1
        for j in 1:(length(axis_rng) - 1)
            ind_1 = [axis_rng[i] <= x < axis_rng[i + 1] for x in ey]
            ind_2 = [axis_rng[j] <= x < axis_rng[j + 1] for x in gt_ey]
            mat_y[i,j] = sum(ind_1 .& ind_2)
            ind_1 = [axis_rng[i] <= x < axis_rng[i + 1] for x in eyy]
            ind_2 = [axis_rng[j] <= x < axis_rng[j + 1] for x in gt_eyy]
            mat_yy[i,j] = sum(ind_1 .& ind_2)
        end
    end

    # Plot
    mat_y .+= 1
    mat_yy .+= 1
    mat_y ./= sum(mat_y)
    mat_yy ./= sum(mat_yy)
    mat_y_log10 = -log10.(mat_y)
    mat_yy_log10 = -log10.(mat_yy)
    xlab = "Fine-grain (WGBS)"
    ylab = "Coarse-grain (Nanopore)"
    axis_labs = [isodd(i) ? "$(axis_rng[i])" : "" for i = 1:(length(axis_rng))]
    axis_ticks = (1:length(axis_labs), axis_labs)
    p_ex = heatmap(mat_y_log10, xlabel=xlab, ylabel=ylab, xticks=axis_ticks, yticks=axis_ticks,
        label="", c=cgrad([:white, :black]), clims=(1, 4.3), title="E[X] (\\rho=$(round(cor(gt_ey, ey);digits=2)))", xrotation=45);
    p_exx = heatmap(mat_yy_log10, xlabel=xlab, ylabel=ylab, xticks=axis_ticks, yticks=axis_ticks,
        label="", c=cgrad([:white, :black]), clims=(1, 4.3), title="E[XX] (\\rho=$(round(cor(gt_eyy, eyy);digits=2)))", xrotation=45);
    plot(p_ex, p_exx, layout=(1, 2), size=(1100, 500), top_margin=10px, bottom_margin=20px,
        left_margin=20px, right_margin=20px)
    savefig("$(nano_dir)/Heatmap-Exp-Aim-3-Log-Res-$(res_grid).pdf")

    # Return nothing
    return nothing

end
function plt_stats_heatmap()

    # Ground-truth quantities
    gt_mml_file = "$(wgbs_dir)/GM12878_wgbs_cpelnano_mml.txt.gz"
    gt_nme_file = "$(wgbs_dir)/GM12878_wgbs_cpelnano_nme.txt.gz"
    gt_mml_sts, gt_mml = read_in_ex_file(gt_mml_file)
    gt_nme_sts, gt_nme = read_in_ex_file(gt_nme_file)

    # Estimated quantities
    mml_file = "$(nano_dir)/gm12878_chr22_cpelnano_mml.txt.gz"
    nme_file = "$(nano_dir)/gm12878_chr22_cpelnano_nme.txt.gz"
    mml_sts, mml = read_in_ex_file(mml_file)
    nme_sts, nme = read_in_ex_file(nme_file)

    # Find common regions E[X]
    wgbs_sts_mml_ind, mml_sts_ind = find_comm_regions(gt_mml_sts, mml_sts)
    gt_mml = gt_mml[wgbs_sts_mml_ind]
    mml = mml[mml_sts_ind]

    # Find common regions E[XX]
    wgbs_sts_nme_ind, nme_sts_ind = find_comm_regions(gt_nme_sts, nme_sts)
    gt_nme = gt_nme[wgbs_sts_nme_ind]
    nme = nme[nme_sts_ind]

    # Construct matrix
    res_grid = 0.05
    axis_rng = collect(0:res_grid:1.0)
    mat_mml = fill(0.0, (length(axis_rng) - 1, length(axis_rng) - 1))
    mat_nme = fill(0.0, (length(axis_rng) - 1, length(axis_rng) - 1))
    for i in (length(axis_rng) - 1):-1:1
        for j in 1:(length(axis_rng) - 1)
            ind_1 = [axis_rng[i] <= x < axis_rng[i + 1] for x in mml]
            ind_2 = [axis_rng[j] <= x < axis_rng[j + 1] for x in gt_mml]
            mat_mml[i,j] = sum(ind_1 .& ind_2)
            ind_1 = [axis_rng[i] <= x < axis_rng[i + 1] for x in nme]
            ind_2 = [axis_rng[j] <= x < axis_rng[j + 1] for x in gt_nme]
            mat_nme[i,j] = sum(ind_1 .& ind_2)
        end
    end

    # Plot
    mat_mml .+= 1
    mat_nme .+= 1
    mat_mml ./= sum(mat_mml)
    mat_nme ./= sum(mat_nme)
    mat_mml_log10 = -log10.(mat_mml)
    mat_nme_log10 = -log10.(mat_nme)
    xlab = "Fine-grain (WGBS)"
    ylab = "Coarse-grain (Nanopore)"
    axis_labs = [isodd(i) ? "$(axis_rng[i])" : "" for i = 1:(length(axis_rng))]
    axis_ticks = (1:length(axis_labs), axis_labs)
    p_mml = heatmap(mat_mml_log10, xlabel=xlab, ylabel=ylab, xticks=axis_ticks, yticks=axis_ticks, label="",
        c=cgrad([:white, :black]), clims=(1, 4.3), title="MML (\\rho=$(round(cor(gt_mml, mml);digits=2)))", xrotation=45);
    p_nme = heatmap(mat_nme_log10, xlabel=xlab, ylabel=ylab, xticks=axis_ticks, yticks=axis_ticks, label="",
        c=cgrad([:white, :black]), clims=(1, 4.3), title="NME (\\rho=$(round(cor(gt_nme, nme);digits=2)))", xrotation=45);
    plot(p_mml, p_nme, layout=(1, 2), size=(1100, 500), top_margin=10px, bottom_margin=20px, left_margin=20px, right_margin=20px)
    savefig("$(nano_dir)/Heatmap-Stats-Aim-3-Log-Res-$(res_grid).pdf")

    # Return nothing
    return nothing

end
#################################################################################################
# Calls
#################################################################################################

# Scatter parameters
println("Generating: Scatter parameters")
plt_params_scatter()

# Heatmap Expectations
println("Generating: Heatmap expectations")
plt_exp_heatmap()

# Heatmap Statistics
println("Generating: Heatmap expectations")
plt_stats_heatmap()


text:
# RUN: julia -e "import Brutus; Brutus.lit(:emit_lowered)" --startup-file=no %s 2>&1 | FileCheck %s

select(c) = 1 + (c ? 2 : 3)
emit(select, Bool)

# CHECK: Core.MethodMatch(Tuple{typeof(Main.Main.select), Bool}, svec(), select(c) in Main.Main at /home/mccoy/Dev/brutus/test/Codegen/lower/select.jl:3, true)after translating to MLIR in JLIR dialect:module  {
# CHECK-NEXT:   func nested @"Tuple{typeof(Main.select), Bool}"(%arg0: !jlir<"typeof(Main.select)">, %arg1: !jlir.Bool) -> !jlir.Int64 attributes {llvm.emit_c_interface} {
# CHECK-NEXT:     "jlir.goto"()[^bb1] : () -> ()
# CHECK-NEXT:   ^bb1:  // pred: ^bb0
# CHECK-NEXT:     "jlir.gotoifnot"(%arg1)[^bb3, ^bb2] {operand_segment_sizes = dense<[1, 0, 0]> : vector<3xi32>} : (!jlir.Bool) -> ()
# CHECK-NEXT:   ^bb2:  // pred: ^bb1
# CHECK-NEXT:     %0 = "jlir.constant"() {value = #jlir<"2">} : () -> !jlir.Int64
# CHECK-NEXT:     "jlir.goto"(%0)[^bb4] : (!jlir.Int64) -> ()
# CHECK-NEXT:   ^bb3:  // pred: ^bb1
# CHECK-NEXT:     %1 = "jlir.constant"() {value = #jlir<"3">} : () -> !jlir.Int64
# CHECK-NEXT:     "jlir.goto"(%1)[^bb4] : (!jlir.Int64) -> ()
# CHECK-NEXT:   ^bb4(%2: !jlir.Int64):  // 2 preds: ^bb2, ^bb3
# CHECK-NEXT:     %3 = "jlir.constant"() {value = #jlir<"#<intrinsic #2 add_int>">} : () -> !jlir<"typeof(Core.IntrinsicFunction)">
# CHECK-NEXT:     %4 = "jlir.constant"() {value = #jlir<"1">} : () -> !jlir.Int64
# CHECK-NEXT:     %5 = "jlir.call"(%3, %4, %2) : (!jlir<"typeof(Core.IntrinsicFunction)">, !jlir.Int64, !jlir.Int64) -> !jlir.Int64
# CHECK-NEXT:     "jlir.return"(%5) : (!jlir.Int64) -> ()
# CHECK-NEXT:   }
# CHECK-NEXT: }

# CHECK: module  {
# CHECK-NEXT:   func nested @"Tuple{typeof(Main.select), Bool}"(%arg0: !jlir<"typeof(Main.select)">, %arg1: i1) -> i64 attributes {llvm.emit_c_interface} {
# CHECK-NEXT:     %c2_i64 = constant 2 : i64
# CHECK-NEXT:     %c3_i64 = constant 3 : i64
# CHECK-NEXT:     %c1_i64 = constant 1 : i64
# CHECK-NEXT:     %0 = select %arg1, %c2_i64, %c3_i64 : i64
# CHECK-NEXT:     %1 = addi %0, %c1_i64 : i64
# CHECK-NEXT:     return %1 : i64
# CHECK-NEXT:   }
# CHECK-NEXT: }

# CHECK:   llvm.func @"Tuple{typeof(Main.select), Bool}"(%arg0: !llvm.ptr<struct<"struct_jl_value_type", opaque>>, %arg1: i1) -> i64 attributes {llvm.emit_c_interface, sym_visibility = "nested"} {
# CHECK-NEXT:     %0 = llvm.mlir.constant({{[0-9]+}} : i64) : i64
# CHECK-NEXT:     %1 = llvm.mlir.constant({{[0-9]+}} : i64) : i64
# CHECK-NEXT:     %2 = llvm.mlir.constant({{[0-9]+}} : i64) : i64
# CHECK-NEXT:     %3 = llvm.select %arg1, %0, %1 : i1, i64
# CHECK-NEXT:     %4 = llvm.add %3, %2  : i64
# CHECK-NEXT:     llvm.return %4 : i64
# CHECK-NEXT:   }
# CHECK-NEXT:   llvm.func @"_mlir_ciface_Tuple{typeof(Main.select), Bool}"(%arg0: !llvm.ptr<struct<"struct_jl_value_type", opaque>>, %arg1: i1) -> i64 attributes {llvm.emit_c_interface, sym_visibility = "nested"} {
# CHECK-NEXT:     %0 = llvm.call @"Tuple{typeof(Main.select), Bool}"(%arg0, %arg1) : (!llvm.ptr<struct<"struct_jl_value_type", opaque>>, i1) -> i64
# CHECK-NEXT:     llvm.return %0 : i64
# CHECK-NEXT:   }
# CHECK-NEXT: }

max_stars_repo_name: JuliaLabs/brutus

max_issues_repo_name: JuliaLabs/brutus

max_forks_repo_name: JuliaLabs/brutus


text:
using ADCME
using PyCall
using LinearAlgebra
using PyPlot
using SparseArrays
using Random
Random.seed!(233)

function sparse_concate(A1, A2,hcat_::Bool)
    m1,n1 = size(A1)
    m2,n2 = size(A2)
    if !isa(A1, SparseTensor); A1 = SparseTensor(A1); end
    if !isa(A2, SparseTensor); A2 = SparseTensor(A2); end
    ii1,jj1,vv1 = find(A1)
    ii2,jj2,vv2 = find(A2)
    sparse_concate_ = load_op_and_grad("./build/libSparseConcate","sparse_concate", multiple=true)
    ii1,jj1,vv1,m1_,n1_,ii2,jj2,vv2,m2_,n2_ = convert_to_tensor([ii1,jj1,vv1,m1,n1,ii2,jj2,vv2,m2,n2], [Int64,Int64,Float64,Int32,Int32,Int64,Int64,Float64,Int32,Int32])
    ii,jj,vv = sparse_concate_(ii1,jj1,vv1,m1_,n1_,ii2,jj2,vv2,m2_,n2_,constant(hcat_))
    if hcat_
        SparseTensor(ii,jj,vv, m1, n1+n2)
    else
        SparseTensor(ii,jj,vv,m1+m2,n1)
    end
end

# TODO: specify your input parameters
A1 = sprand(10,10,0.4)
A2 = sprand(10,10,0.3)
u = sparse_concate(A1, A2, true)
sess = Session(); init(sess)
@show run(sess, u)-[A1 A2]

u = sparse_concate(A1, A2, false)
sess = Session(); init(sess)
@show run(sess, u)-[A1;A2]

# uncomment it for testing gradients
# error()

# TODO: change your test parameter to `m`
#       in the case of `multiple=true`, you also need to specify which component you are testings
# gradient check -- v
function scalar_function(m)
    A1 = SparseTensor(ii1,jj1,m,10,10)
    A2 = SparseTensor(ii2,jj2,m,10,10)
    return sum(sparse_concate(A1, A2, false))^2
end

# TODO: change `m_` and `v_` to appropriate values
ii1 = rand(1:10,10)
jj1 = rand(1:10,10)
ii2 = rand(1:10,10)
jj2 = rand(1:10,10)
vv1 = rand(10)
vv2 = rand(10)
m_ = constant(rand(10))
v_ = rand(10)
y_ = scalar_function(m_)
dy_ = gradients(y_, m_)
ms_ = Array{Any}(undef, 5)
ys_ = Array{Any}(undef, 5)
s_ = Array{Any}(undef, 5)
w_ = Array{Any}(undef, 5)
gs_ =  @. 1 / 10^(1:5)

for i = 1:5
    g_ = gs_[i]
    ms_[i] = m_ + g_*v_
    ys_[i] = scalar_function(ms_[i])
    s_[i] = ys_[i] - y_
    w_[i] = s_[i] - g_*sum(v_.*dy_)
end

sess = Session(); init(sess)
sval_ = run(sess, s_)
wval_ = run(sess, w_)
close("all")
loglog(gs_, abs.(sval_), "*-", label="finite difference")
loglog(gs_, abs.(wval_), "+-", label="automatic differentiation")
loglog(gs_, gs_.^2 * 0.5*abs(wval_[1])/gs_[1]^2, "--",label="\$\\mathcal{O}(\\gamma^2)\$")
loglog(gs_, gs_ * 0.5*abs(sval_[1])/gs_[1], "--",label="\$\\mathcal{O}(\\gamma)\$")

plt.gca().invert_xaxis()
legend()
xlabel("\$\\gamma\$")
ylabel("Error")


text:
module DatagenCopulaBased
  using Distributions
  using Combinatorics
  using HypothesisTests
  using HCubature
  using StatsBase
  using QuadGK
  using Roots
  using SpecialFunctions
  using Random
  using LinearAlgebra
  using Distributed
  using SharedArrays
  if VERSION >= v"1.3"
    using CompilerSupportLibraries_jll
  end

  include("simulate_copula.jl")
  include("sampleunivdists.jl")
  include("corgen.jl")
  include("marshallolkincopcor.jl")
  include("archcopcorrelations.jl")

  # particular copulas famillies
  include("eliptic_fr_mo_copulas.jl")
  include("archcopulagendat.jl")
  include("nestedarchcopulagendat.jl")
  include("chaincopulagendat.jl")

  # change Gaussian data by adding higher order cross-correlations
  include("add_higher_order_cors.jl")

  export Gaussian_cop, Student_cop, Frechet_cop, Marshall_Olkin_cop
  export Gumbel_cop, Gumbel_cop_rev, Clayton_cop, Clayton_cop_rev, AMH_cop, AMH_cop_rev, Frank_cop
  export Nested_Clayton_cop, Nested_AMH_cop, Nested_Frank_cop, Nested_Gumbel_cop
  export Double_Nested_Gumbel_cop, Hierarchical_Gumbel_cop
  export Chain_of_Archimedeans, Chain_of_Frechet
  export SpearmanCorrelation, KendallCorrelation, CorrelationType
  export cormatgen, cormatgen_constant, cormatgen_toeplitz, convertmarg!
  export cormatgen_constant_noised, cormatgen_toeplitz_noised, cormatgen_rand
  export cormatgen_two_constant, cormatgen_two_constant_noised

  export gcop2tstudent, gcop2frechet, gcop2marshallolkin, gcop2arch

  export simulate_copula, simulate_copula!

end


text:
#
# @description Defines the multiblock-cipher abstract type and the helper methods that act on this abstract type.
#
# @author Alejandro Claro (alejandro.claro@gmail.com)
#
# Copyright 2015 All rights reserved.
# Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
#
export MultiBlockCipher
export encrypt, decrypt

# @description Defines the multiblock-cipher abstract type. A multiblock-cipher is an algorithm that uses a block
# cipher repeatedly to securely transform amounts of data larger than a block.
abstract type MultiBlockCipher end

# @description Encrypts the given plaintext with the key set at initialization.
#
# @param {MultiBlockCipher} self      The cipher data struture.
# @param {AbstractString}   plaintext The message to encrypt.
#
# @return {Vector{UInt8}} The resulting ciphertext.
function encrypt(self::MultiBlockCipher, plaintext::AbstractString)
  return encrypt(self, convert(Array{UInt8}, plaintext))
end

# @description Encrypts the given plaintext with the key set at initialization.
#
# @param {MultiBlockCipher} self      The cipher data struture.
# @param {Vector{UInt8}}    plaintext The message to encrypt.
#
# @return {Vector{UInt8}} The resulting ciphertext.
function encrypt(self::MultiBlockCipher, plaintext::Vector{UInt8})
  return process(self, encrypt_next_blocks!, encrypt_last_block!, plaintext)
end

# @description Decrypts the given ciphertext with the key set at initialization.
#
# @param {MultiBlockCipher} sself       The cipher data struture.
# @param {Vector{UInt8}}    ciphertext The message to decrypt.
#
# @return {Vector{UInt8}} The resulting plaintext.
function decrypt(self::MultiBlockCipher, ciphertext::Vector{UInt8})
  return process(self, decrypt_next_blocks!, decrypt_last_block!, ciphertext)
end

# @description Encrypts or decrypts the given data with the key set at initialization.
#
# @param {MultiBlockCipher} self               The cipher data struture.
# @param {Function}         process_blocks     The cipher operation function.
# @param {Function}         process_last_block The cipher operation function.
# @param {Vector{UInt8}}    data               The message to process.
#
# @return {Vector{UInt8}} The processed data.
function process(self::MultiBlockCipher, process_blocks::Function, process_last_block::Function, data::Vector{UInt8})
  context     = deepcopy(self)
  bz          = block_size(context)
  blocks      = floor(UInt64, length(data) / bz)
  split_index = 1 + maximum(Int64[ 0, (blocks - 1) * bz])
  result      = UInt8[]

  reset!(context)

  if split_index > 1
    result = process_blocks(context, data[1 : (split_index - 1)])
  end

  return vcat(result, process_last_block(context, data[split_index : end]))
end


text:
module types

using DataFrames

# Abstract class for all resource modules
abstract type ResourceVariable end

abstract type ProgramVariable end

abstract type ProjectVariable <: ProgramVariable end

abstract type LaborVariable <: ResourceVariable end

abstract type FinanceVariable end

abstract type BudgetVariable <: FinanceVariable end

abstract type CostVariable <: FinanceVariable end

# -----------------------------------------------

# Concrete Type

"""
    BudgetVariable

# Fields
`Hours::Real` : Stores Budget Hours for the Object
`QuotedDollars::Real` : Stores Budget Dollars for the Object
`Rate::Real` : Stores Budget Rate for the Object (dollars per hour)
`TravelDollars::Real` : Stores Budget Travel Dollars for the Object
"""
mutable struct Budget <: BudgetVariable
    Dept ::String
    Hours::Real                 # Budget in hours
    Rate::Real                  # Rate of dollars per hour
    TravelDollars::Real         # Budget in dollars for travel

    QuotedDollars_ENG::Real         # Budget in dollars used for quoted costs
    Var_ENG :: Real                  # Difference between quoted budget and Projected costs

    QuotedDollars_HDWR::Real         # Budget in dollars used for quoted costs
    Var_HDWR :: Real                  # Difference between quoted budget and Projected costs

    QuotedDollars_RESALE::Real         # Budget in dollars used for quoted costs
    Var_RESALE :: Real                  # Difference between quoted budget and Projected costs

    function Budget()           # Standard Constructor Function

        new("", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

    end

end

mutable struct Cost <: CostVariable

    Dept::String

    ActualHours::Real           # Cost in hours
    ActualTravel::Real          # Cost in dollars for travel

    Actual_ENG::Real                # Cost in dollars used for quoted costs
    Anticipated_ENG:: Real          # Cost in dollars for anticipated costs
    Projected_ENG:: Real            # Cost in dollars for projected costs

    Actual_HDWR::Real                # Cost in dollars used for quoted costs
    Anticipated_HDWR:: Real          # Cost in dollars for anticipated costs
    Projected_HDWR:: Real            # Cost in dollars for projected costs

    Actual_RESALE::Real                # Cost in dollars used for quoted costs
    Anticipated_RESALE:: Real          # Cost in dollars for anticipated costs
    Projected_RESALE:: Real            # Cost in dollars for projected costs

    function Cost() # Standard Constructor Function

        new("", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

    end

end

mutable struct Project <: ProjectVariable
    Number :: String              # Project Number
    Customer:: String           # Customer Name

    Budget::Array{Budget, 1}              # Budget for the Project
    Cost:: Array{Cost, 1}                  # Cost for the Project

    FwdHoursForecast::DataFrame         # Array holding Hours Forecasted Fwd monthly(future). Element [1] is the first month forecasted.
    RevHoursForecast::DataFrame          # Array holding Hours Forecasted Rev monthly (in past). Element [1] is the first month forecasted.

    function Project(project::String, customer::String) # Standard Constructor Function

        new(project, customer, Array{Budget, 1}(), Array{Cost, 1}(), DataFrame(Employee=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
        Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
        Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
        Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
        Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
        Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}()), DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
        Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
        Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
        Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
        Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
        Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}()));

    end

end

"""
    Program <: ProgramVariable

    # Fields
    `Projects::Array{Project, 1}` : Stores the Projects for the Program
    `Name::String` : Stores the Name of the Program

"""
mutable struct Program <: ProgramVariable
    Name :: String              # Program Name
    Projects :: Array{Project, 1} # Projects in the Program
    function Program() # Standard Constructor Function

        new("", Array{Project, 1}());

    end

end

"""
    DisciplineLabor

# Fields
- `Hours::Real <:Budget` : Stores Budget Hours for the Object
- `Dollars::Real <: Budget` : Stores Budget Dollars for the Object
- `Rate::Real <: Budget` : Stores Budget Rate for the Object (dollars per hour)
- `TravelDollars::Real <: Budget` : Stores Budget Travel Dollars for the Object
- `ActualHours::Float64 `: stores actual incurred hours for resource
- `ActualHours::Float64 `: stores actual incurred hours for resource
- `ActualIncurredCost::Float64`: stores actual incurred Costs
- `FwdHoursAvailable::Array`: stores monthly Hours Available from Present going forward
- `FwdHoursForecast::Vector{Vector{Int64}} `: stores Forecast monthly Hours from Present month going forward
- `RevHoursForecast::Array`: stores Forecast monthly Hours from Present month going backwards (reverse)
- `RevHoursAvailable::Array`: stores Forecast monthly Hours from Present month going backwards (reverse)
- `FwdCostsForecast::Array`: stores forecasted monthly Labor cost  from Present going forward
- `RevCostsForecast::Array`: stores forecasted monthly Labor cost  from Present going backwards (reverse)
- `RevActualCostHours::Array `: stores monthly actual labor costs  from Present going backwards (reverse)
- `Dept::String`: stores Dept name
- `Name::String`: stores name of the resource
- `Projects::Array`: stores projects for the resource
"""
mutable struct  DisciplineLabor <:LaborVariable

    FwdHoursAvailable::Array        # Fwd Hours Available on a given month.
    FwdHoursForecast::DataFrame         # Array holding Hours Forecasted Fwd monthly(future). Element [1] is the first month forecasted.
    RevHoursForecast::DataFrame           # Array holding Hours Forecasted Rev monthly (in past). Element [1] is the first month forecasted.
    RevHoursAvailable::Array        # Array holding Hours Available Rev monthly (in past). Element [1] is the first month forecasted.

    FwdCostsForecast::Array          # Array holding costs Forecasted Fwd monthly (future)
    RevCostsForecast::Array         # Array holding costs Forecasted Rev  monthly (past)

    RevActualHours::DataFrame        # Array holding Hours incurred Rev monthly (in past). Element [1] is the first month Actual Hours.
    RevActualCostHours::Array     # Array holding Hours in Dollar Amounts incurred Rev monthly (in past)

    Dept::String                        # Department for Discipline

    Name::String                    # name of resource

    Projects::Array                 # Project for Discipline

    """
        DisciplineLabor()

    Standard Constructor for Discipline Labor.
    ```
    new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Array{Float64, 1}(undef, 12), Vector{Vector{Int64}}(), Array{Float64, 1}(undef, 12), Array{Float64, 1}(undef, 12) ,
            Array{Float64, 1}(undef, 12), Array{Float64, 1}(undef, 12), "430300")
    ```

        DisciplineLabor(Dept, N)
    Detailed Constructor for Discipline Labor. Specifies Dept and number of months to hold forecast and actuals (N)

    # Examples
    ```julia
    CE = DisciplineLabor()

    ```
    """
    function DisciplineLabor()      # standard constructor supplied, all zerors, with 24 months array as default

        new(Array{Float64, 1}(), DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
        Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
        Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
        Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
        Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
        Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
        ,
         DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
         Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
            Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
            Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
            Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
            Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
         , Array{Float64, 2}(undef, 24, 24),  Array{Float64, 2}(undef, 24, 24), Array{Float64, 2}(undef, 24,24) ,
        DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
        Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
           Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
           Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
           Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
           Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
           , Array{Float64, 2}(undef, 24, 24), "430300","", Array{String, 1}())

    end

    """
        DisciplineLabor(Dept,Name)

    Standard Constructor for Discipline Labor'

        # Parameters
        Dept::String
        Name::String
        N::Int

    ```
    new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Array{Float64, 1}(undef, 12), Vector{Vector{Int64}}(), Array{Float64, 1}(undef, 12), Array{Float64, 1}(undef, 12) ,
            Array{Float64, 1}(undef, 12), Array{Float64, 1}(undef, 12), "430300")
    ```

        DisciplineLabor(Dept, N)
    Detailed Constructor for Discipline Labor. Specifies Dept and number of months to hold forecast and actuals (N)

    # Examples
    ```julia
    CE = DisciplineLabor()

    ```
    """
    function DisciplineLabor(Dept::String, Name::String)      # standard constructor supplied, all zerors, with 24 months array as default

        new(Array{Float64, 1}(), DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
        Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
        Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
        Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
        Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
        Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
        ,
         DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
         Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
            Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
            Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
            Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
            Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
         , Array{Float64, 2}(undef, 24, 24),  Array{Float64, 2}(undef, 24, 24), Array{Float64, 2}(undef, 24,24) ,
        DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
        Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
           Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
           Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
           Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
           Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
           , Array{Float64, 2}(undef, 24, 24), Dept,Name, Array{String, 1}())

    end

end

"""
    TeamLabor()

Generates a TeamLabor object.

# Arguments
- `Team::Array`: Array of DisciplineLabor objects
- `Name::String`: Name of the Team
- `Dept::String`: Department of the Team
- `Hours::Real <:Budget` : Stores Budget Hours for the Object
- `Dollars::Real <: Budget` : Stores Budget Dollars for the Object
- `Rate::Real <: Budget` : Stores Budget Rate for the Object (dollars per hour)
- `TravelDollars::Real <: Budget` : Stores Budget Travel Dollars for the Object
- `ActualHours::Float64`: Total Incurred Hours
- `ActualIncurredCost::Float64`: Total Incurred Cost
- `Projects::Array` : Array of Projects for the Team
- `FwdHoursAvailable::Array`: stores Fwd Hours Available on a given month.
- `FwdHoursForecast::Vector{Vector{Int64}} `: stores Forecast monthly Hours from Present month going forward
- `RevHoursForecast::Array`: stores Forecast monthly Hours from Present month going backwards (reverse)
- `RevHoursAvailable::Array`: stores Available monthly Hours from Present month going backwards (reverse)
- `FwdCostsForecast::Array`: stores Forecasted monthly Labor cost  from Present going forward
- `RevCostsForecast::Array`: stores Forecasted monthly Labor cost  from Present going backwards (reverse)
- `RevActualHours::Array`: stores Actual monthly Hours from Present month going backwards (reverse)
- `RevActualCostHours::Array`: stores Actual monthly Labor cost  from Present going backwards (reverse)

# Returns
- `TeamLabor`: TeamLabor object
"""
mutable struct  TeamLabor <:LaborVariable

    Team::Array{DisciplineLabor, 1}
    Name::String # name of team
    Dept::String                        # Department for Discipline

    Projects::Array # project name
    FwdHoursAvailable::Array        # Fwd Hours Available on a given month.
    FwdHoursForecast::DataFrame        # DataFrame holding Hours Forecasted Fwd monthly(future). Element [1] is the first month forecasted.
    RevHoursForecast::DataFrame        # Array holding Hours Forecasted Rev monthly (in past). Element [1] is the first month forecasted.
    RevHoursAvailable::Array        # Array holding Hours Available Rev monthly (in past). Element [1] is the first month forecasted.
    FwdCostsForecast::Array          # Array holding costs Forecasted Fwd monthly (future)
    RevCostsForecast::Array         # Array holding costs Forecasted Rev  monthly (past)
    RevActualHours::DataFrame       # Array holding Hours incurred Rev monthly (in past). Element [1] is the first month Actual Hours.
    RevActualCostHours::Array     # Array holding Hours in Dollar Amounts incurred Rev monthly (in past)

    function TeamLabor()
        new(Array{DisciplineLabor, 1}(),  "", "", Array{String, 1}(),
        Array{Float64, 1}(), DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
        Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
        Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
        Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
        Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
        Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
        ,
         DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
         Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
            Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
            Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
            Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
            Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
         , Array{Float64, 2}(undef, 24, 24),  Array{Float64, 2}(undef, 24, 24), Array{Float64, 2}(undef, 24,24) ,
        DataFrame(Project=  Array{String,1}(), Month1 = Array{Int64, 1}(), Month2 = Array{Int64, 1}(), Month3 = Array{Int64, 1}(),
        Month4 = Array{Int64, 1}(), Month5 = Array{Int64, 1}(), Month6 = Array{Int64, 1}(), Month7 = Array{Int64, 1}(), Month8 = Array{Int64, 1}(),
           Month9 = Array{Int64, 1}(), Month10 = Array{Int64, 1}(), Month11 = Array{Int64, 1}(), Month12 = Array{Int64, 1}(),
           Month13 = Array{Int64, 1}(), Month14 = Array{Int64, 1}(), Month15 = Array{Int64, 1}(), Month16 = Array{Int64, 1}(), Month17 = Array{Int64, 1}(),
           Month18 = Array{Int64, 1}(), Month19 = Array{Int64, 1}(), Month20 = Array{Int64, 1}(), Month21 = Array{Int64, 1}(), Month22 = Array{Int64, 1}(),
           Month23 = Array{Int64, 1}(), Month24 = Array{Int64, 1}())
           , Array{Float64, 2}(undef, 24, 24))
    end

end

# Defining how the types show up on Standard IO:
Base.show(io::IO, D::DisciplineLabor) = print(io, "(👨, " , D.Name, ", ", D.Dept, ", Hello: Ready to help!")
Base.show(io::IO, D::TeamLabor) = print(io, "(👨 , 👩  " , D.Name, ", ", D.Dept, ", Alpha Team ready to help!")
Base.show(io::IO, p::Project) = print(io, "(💼, " , p.Number, ", ", p.Customer, ", Make every Project a Success 💪🏻 before it even begins!")
Base.show(io::IO, p::Program) = print(io, "(💼, 💼, " , p.Name,  ", Program launched! 🚀🚀🚀")

end


text:
export project_rank!

function project_rank!(
                      x :: Array{TF,2},
                      r :: TI,
                      mode #not an option for matrices
                      ) where {TF<:Real,TI<:Integer}
"""
Project the matrix X onto the set of rank-r ( need r<min(n1,n2) ) matrices
outputs a vector. Uses singular value decomposition
"""
  F  = svd(x)
  x .= F.U[:,1:r] * diagm(0 => F.S[1:r])* F.Vt[1:r,:]
  x  = vec(x)
end

function project_rank!(
                      x :: Array{TF,3},
                      r :: TI,
                      mode ::Tuple{String,String}
                      ) where {TF<:Real,TI<:Integer}
"""
Project each slice (x,y or z) of the tensor (3D model) onto the set of rank-r ( need r<min(n1,n2) ) matrices
outputs a vector. Uses singular value decomposition
"""
if mode[1] == "slice"
  if mode[2] == "x" #project y-z slices, so one slice per gridpoint in the x direction
    Threads.@threads for i=1:size(x,1)
      F = svd(view(x,i,:,:))
      @inbounds x[i,:,:] .= F.U[:,1:r] * diagm(0 => F.S[1:r])* F.Vt[1:r,:]
    end
  elseif mode[2] == "y"
    Threads.@threads for i=1:size(x,2)
      F = svd(view(x,:,i,:))
      @inbounds x[:,i,:] .= F.U[:,1:r] * diagm(0 => F.S[1:r])* F.Vt[1:r,:]
    end
  elseif mode[2] == "z"
    Threads.@threads for i=1:size(x,3)
      F=svd(view(x,:,:,i))
      @inbounds x[:,:,i] .= F.U[:,1:r] * diagm(0 => F.S[1:r])* F.Vt[1:r,:]
    end
  end #end if mode[2]
else
 error("mode[1] for rank projections can only be: slice")
end #if mode[1]

  x=vec(x)
end

max_stars_repo_name: slimgroup/SetIntersectionProjection

max_issues_repo_name: slimgroup/SetIntersectionProjection

max_forks_repo_name: slimgroup/SetIntersectionProjection


text:
function Base.show(io::IO, mime::Union{MIME"image/svg+xml", MIME"text/latex"}, x::WExpr)
    if mime == MIME"text/latex"() && x.head != WSymbol("Graphics")
        type = "TeXFragment"
    elseif mime == MIME"image/svg+xml"() && x.head == WSymbol("Graphics")
        type = "SVG"
    else
        throw(MethodError(Base.show, (io, mime, x)))
    end
    out = weval(:ExportString(:HoldForm(x), type))
    write(io, out)
end


text:
# This file was generated by the Julia Swagger Code Generator
# Do not modify this file directly. Modify the swagger specification instead.

@doc raw"""Event is a report of an event somewhere in the cluster.

    IoK8sApiCoreV1Event(;
        action=nothing,
        apiVersion=nothing,
        count=nothing,
        eventTime=nothing,
        firstTimestamp=nothing,
        involvedObject=nothing,
        kind=nothing,
        lastTimestamp=nothing,
        message=nothing,
        metadata=nothing,
        reason=nothing,
        related=nothing,
        reportingComponent=nothing,
        reportingInstance=nothing,
        series=nothing,
        source=nothing,
        type=nothing,
    )

    - action::String : What action was taken/failed regarding to the Regarding object.
    - apiVersion::String : APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
    - count::Int32 : The number of times this event has occurred.
    - eventTime::IoK8sApimachineryPkgApisMetaV1MicroTime : Time when this Event was first observed.
    - firstTimestamp::IoK8sApimachineryPkgApisMetaV1Time : The time at which the event was first recorded. (Time of server receipt is in TypeMeta.)
    - involvedObject::IoK8sApiCoreV1ObjectReference : The object that this event is about.
    - kind::String : Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
    - lastTimestamp::IoK8sApimachineryPkgApisMetaV1Time : The time at which the most recent occurrence of this event was recorded.
    - message::String : A human-readable description of the status of this operation.
    - metadata::IoK8sApimachineryPkgApisMetaV1ObjectMeta : Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
    - reason::String : This should be a short, machine understandable string that gives the reason for the transition into the object's current status.
    - related::IoK8sApiCoreV1ObjectReference : Optional secondary object for more complex actions.
    - reportingComponent::String : Name of the controller that emitted this Event, e.g. `kubernetes.io/kubelet`.
    - reportingInstance::String : ID of the controller instance, e.g. `kubelet-xyzf`.
    - series::IoK8sApiCoreV1EventSeries : Data about the Event series this event represents or nil if it's a singleton Event.
    - source::IoK8sApiCoreV1EventSource : The component reporting this event. Should be a short machine understandable string.
    - type::String : Type of this event (Normal, Warning), new types could be added in the future
"""
mutable struct IoK8sApiCoreV1Event <: SwaggerModel
    action::Any # spec type: Union{ Nothing, String } # spec name: action
    apiVersion::Any # spec type: Union{ Nothing, String } # spec name: apiVersion
    count::Any # spec type: Union{ Nothing, Int32 } # spec name: count
    eventTime::Any # spec type: Union{ Nothing, IoK8sApimachineryPkgApisMetaV1MicroTime } # spec name: eventTime
    firstTimestamp::Any # spec type: Union{ Nothing, IoK8sApimachineryPkgApisMetaV1Time } # spec name: firstTimestamp
    involvedObject::Any # spec type: Union{ Nothing, IoK8sApiCoreV1ObjectReference } # spec name: involvedObject
    kind::Any # spec type: Union{ Nothing, String } # spec name: kind
    lastTimestamp::Any # spec type: Union{ Nothing, IoK8sApimachineryPkgApisMetaV1Time } # spec name: lastTimestamp
    message::Any # spec type: Union{ Nothing, String } # spec name: message
    metadata::Any # spec type: Union{ Nothing, IoK8sApimachineryPkgApisMetaV1ObjectMeta } # spec name: metadata
    reason::Any # spec type: Union{ Nothing, String } # spec name: reason
    related::Any # spec type: Union{ Nothing, IoK8sApiCoreV1ObjectReference } # spec name: related
    reportingComponent::Any # spec type: Union{ Nothing, String } # spec name: reportingComponent
    reportingInstance::Any # spec type: Union{ Nothing, String } # spec name: reportingInstance
    series::Any # spec type: Union{ Nothing, IoK8sApiCoreV1EventSeries } # spec name: series
    source::Any # spec type: Union{ Nothing, IoK8sApiCoreV1EventSource } # spec name: source
    type::Any # spec type: Union{ Nothing, String } # spec name: type

    function IoK8sApiCoreV1Event(;action=nothing, apiVersion=nothing, count=nothing, eventTime=nothing, firstTimestamp=nothing, involvedObject=nothing, kind=nothing, lastTimestamp=nothing, message=nothing, metadata=nothing, reason=nothing, related=nothing, reportingComponent=nothing, reportingInstance=nothing, series=nothing, source=nothing, type=nothing)
        o = new()
        validate_property(IoK8sApiCoreV1Event, Symbol("action"), action)
        setfield!(o, Symbol("action"), action)
        validate_property(IoK8sApiCoreV1Event, Symbol("apiVersion"), apiVersion)
        setfield!(o, Symbol("apiVersion"), apiVersion)
        validate_property(IoK8sApiCoreV1Event, Symbol("count"), count)
        setfield!(o, Symbol("count"), count)
        validate_property(IoK8sApiCoreV1Event, Symbol("eventTime"), eventTime)
        setfield!(o, Symbol("eventTime"), eventTime)
        validate_property(IoK8sApiCoreV1Event, Symbol("firstTimestamp"), firstTimestamp)
        setfield!(o, Symbol("firstTimestamp"), firstTimestamp)
        validate_property(IoK8sApiCoreV1Event, Symbol("involvedObject"), involvedObject)
        setfield!(o, Symbol("involvedObject"), involvedObject)
        validate_property(IoK8sApiCoreV1Event, Symbol("kind"), kind)
        setfield!(o, Symbol("kind"), kind)
        validate_property(IoK8sApiCoreV1Event, Symbol("lastTimestamp"), lastTimestamp)
        setfield!(o, Symbol("lastTimestamp"), lastTimestamp)
        validate_property(IoK8sApiCoreV1Event, Symbol("message"), message)
        setfield!(o, Symbol("message"), message)
        validate_property(IoK8sApiCoreV1Event, Symbol("metadata"), metadata)
        setfield!(o, Symbol("metadata"), metadata)
        validate_property(IoK8sApiCoreV1Event, Symbol("reason"), reason)
        setfield!(o, Symbol("reason"), reason)
        validate_property(IoK8sApiCoreV1Event, Symbol("related"), related)
        setfield!(o, Symbol("related"), related)
        validate_property(IoK8sApiCoreV1Event, Symbol("reportingComponent"), reportingComponent)
        setfield!(o, Symbol("reportingComponent"), reportingComponent)
        validate_property(IoK8sApiCoreV1Event, Symbol("reportingInstance"), reportingInstance)
        setfield!(o, Symbol("reportingInstance"), reportingInstance)
        validate_property(IoK8sApiCoreV1Event, Symbol("series"), series)
        setfield!(o, Symbol("series"), series)
        validate_property(IoK8sApiCoreV1Event, Symbol("source"), source)
        setfield!(o, Symbol("source"), source)
        validate_property(IoK8sApiCoreV1Event, Symbol("type"), type)
        setfield!(o, Symbol("type"), type)
        o
    end
end # type IoK8sApiCoreV1Event

const _property_map_IoK8sApiCoreV1Event = Dict{Symbol,Symbol}(Symbol("action")=>Symbol("action"), Symbol("apiVersion")=>Symbol("apiVersion"), Symbol("count")=>Symbol("count"), Symbol("eventTime")=>Symbol("eventTime"), Symbol("firstTimestamp")=>Symbol("firstTimestamp"), Symbol("involvedObject")=>Symbol("involvedObject"), Symbol("kind")=>Symbol("kind"), Symbol("lastTimestamp")=>Symbol("lastTimestamp"), Symbol("message")=>Symbol("message"), Symbol("metadata")=>Symbol("metadata"), Symbol("reason")=>Symbol("reason"), Symbol("related")=>Symbol("related"), Symbol("reportingComponent")=>Symbol("reportingComponent"), Symbol("reportingInstance")=>Symbol("reportingInstance"), Symbol("series")=>Symbol("series"), Symbol("source")=>Symbol("source"), Symbol("type")=>Symbol("type"))
const _property_types_IoK8sApiCoreV1Event = Dict{Symbol,String}(Symbol("action")=>"String", Symbol("apiVersion")=>"String", Symbol("count")=>"Int32", Symbol("eventTime")=>"IoK8sApimachineryPkgApisMetaV1MicroTime", Symbol("firstTimestamp")=>"IoK8sApimachineryPkgApisMetaV1Time", Symbol("involvedObject")=>"IoK8sApiCoreV1ObjectReference", Symbol("kind")=>"String", Symbol("lastTimestamp")=>"IoK8sApimachineryPkgApisMetaV1Time", Symbol("message")=>"String", Symbol("metadata")=>"IoK8sApimachineryPkgApisMetaV1ObjectMeta", Symbol("reason")=>"String", Symbol("related")=>"IoK8sApiCoreV1ObjectReference", Symbol("reportingComponent")=>"String", Symbol("reportingInstance")=>"String", Symbol("series")=>"IoK8sApiCoreV1EventSeries", Symbol("source")=>"IoK8sApiCoreV1EventSource", Symbol("type")=>"String")
Base.propertynames(::Type{ IoK8sApiCoreV1Event }) = collect(keys(_property_map_IoK8sApiCoreV1Event))
Swagger.property_type(::Type{ IoK8sApiCoreV1Event }, name::Symbol) = Union{Nothing,eval(Base.Meta.parse(_property_types_IoK8sApiCoreV1Event[name]))}
Swagger.field_name(::Type{ IoK8sApiCoreV1Event }, property_name::Symbol) =  _property_map_IoK8sApiCoreV1Event[property_name]

function check_required(o::IoK8sApiCoreV1Event)
    (getproperty(o, Symbol("involvedObject")) === nothing) && (return false)
    (getproperty(o, Symbol("metadata")) === nothing) && (return false)
    true
end

function validate_property(::Type{ IoK8sApiCoreV1Event }, name::Symbol, val)
end


text:
using CmeSIM.Tracks
using CmeSIM.Acquisitions
using Test
using Unitful: s, μm, nm
using Images

@testset "Track" begin

    @testset "mod.jl" begin

        acquisitiontimes = times(acquisition)[9:10]
        @test begin
            typeof(Track([43.45, 45.67], [82.1, 75.98], acquisition, acquisitiontimes)) == Track
        end

        @test begin
            typeof(Track([43.45, 45.67], [82.1, 75.98], acquisition, [12, 13])) == Track
        end

        simacquisitiontimes = times(acquisition)[9:10]
        @test begin
            typeof(SIMTrack([43.45, 45.67], [82.1, 75.98], simacquisition, simacquisitiontimes)) == SIMTrack
        end

        @test begin
            typeof(SIMTrack([43.45, 45.67], [82.1, 75.98], simacquisition, [12, 13])) == SIMTrack
        end

    end

end


text:
using Imogen, Test

import Imogen: genvertices, toposort!, isbelow

near(a::Float64, b::Float64; ϵ=1e-10) = abs(a - b) < ϵ

include("entropy.jl")
include("mi.jl")
include("ai.jl")
include("te.jl")
include("lattice.jl")
include("williamsbeer.jl")