sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3bff2c29ea2a905dbacf11178bbb87e2799a2daab42227db52fc60a20144ae27 | Julia | 1,216 | 31 | @testset "lms basis" begin
# Test 1: test lms basis from s,p and d
s_basis = Hamster.get_lms_basis("s")
p_basis = Hamster.get_lms_basis("p")
d_basis = Hamster.get_lms_basis("d")
@test s_basis == [[0, 0, -1], [0, 0, 1]]
@test p_basis == [[1, -1, -1], [1, -1, 1], [1, 0, -1], [1, 0, 1], [1, 1, -1],... |
db0e698f71da43a01568e44b5f7c35a316d8f6dd6ab4dbe0db8400d330898388 | Julia | 1,222 | 42 | using CubicSplines
const int_tol = 1e-3
@testset "Adaptive interpolation" begin
# Test 1: test function 1
conf = get_empty_config()
set_value!(conf, "itp_xmax", 15)
set_value!(conf, "itp_Ninit", 10)
set_value!(conf, "itp_Nmax", 300)
set_value!(conf, "itp_tol", 1e-6)
f1(x) = (10*x - 7*x^2 +... |
39dd92ebe0864a8dbbbeb9808738226b8f51f8cfbc669f9bdee98860d912af1a | Julia | 1,281 | 45 | const EPS = 1e-8
"""
Adam(η = 0.001, β::Tuple = (0.9, 0.999), ϵ = $EPS)
[Adam](https://arxiv.org/abs/1412.6980) optimiser.
# Parameters
- Learning rate (`η`): Amount by which gradients are discounted before updating
the weights.
- Decay of momentums (`β::Tuple`): Exponential decay for the fi... |
fd6be28d1641e5efa81c810cc5f059aca6d7d2e88bbe6b8a34ea1088821dbd2b | Julia | 1,339 | 39 | import CairoMakie
import Makie
import MAT
using HiddenMarkovModels: logdensityof, baum_welch, transition_matrix, initial_distribution, viterbi
using Statistics: mean
using Test: @test, @testset
using ZebrafishHMM2023: artr_wolf_2023_distances
using ZebrafishHMM2023: artr_wolf_2023_distances_file
using ZebrafishHMM2023:... |
555af112fb2cd2ded0fa7f8ecfa8eac313190d534db9d8d4eef7eed02d935d1c | Julia | 1,346 | 47 | # Implementation adapted from https://github.com/FluxML/Flux.jl
const EPS = 1e-8
"""
Adam(η = 0.001, β::Tuple = (0.9, 0.999), ϵ = $EPS)
[Adam](https://arxiv.org/abs/1412.6980) optimiser.
# Parameters
- Learning rate (`η`): Amount by which gradients are discounted before updating
the weights... |
929e1bc99bde284d2e6a7b73aa996692cbb0d6d32ada151edfa6d541f0551ce8 | Julia | 1,353 | 48 | using Documenter
using Hamster
makedocs(
sitename = "Hamster",
modules = [Hamster],
format = Documenter.HTML(;
# Use clean URLs, unless built as a "local" build
prettyurls=get(ENV, "CI", nothing) == "true",
edit_link="master",
size_threshold=nothing, # do not fail build if large HTML outpu... |
726bdc485baa0e9241f726b4467f5e77b78106aef3351f922fd6e9020373d0fa | Julia | 1,383 | 31 | function markov_equilibrium(transition_matrix::AbstractMatrix)
p_eq = real.(eigvecs(transition_matrix')[:, end])
return p_eq ./ sum(p_eq)
end
#= Stubborness factor for a 4-state model, with the states:
FL, FR, L, R (in that order). =#
function _stubborness_factor_4_state(transition_matrix::AbstractMatrix, ... |
ff630d5e70b907c3d6898a163f03c998b73633e566eb7ec1bb4e1f5c423db640 | Julia | 1,399 | 30 | @testset "soc matrices" begin
# SOC matrices in atomic orbital basis are compared to Gu et al., Comput. Mater. Sci., 221, 112090 (2023)
# Test 1: test s orbitals
M_soc_s = Hamster.get_Msoc_s()
@test M_soc_s ≈ zeros(2, 2)
# Test 2: test p orbitals
Msoc_p = 2 .* Hamster.get_Msoc_p(["pz↑", "px↑",... |
2878ec2cef17a98fb9aa14c92ad0432d628bef9652b12e1734f1b08095a98098 | Julia | 1,416 | 41 | @testset "Config" begin
conf = Hamster.get_empty_config()
# Test convert value
convert_value = Hamster.convert_value
@test convert_value("7.0") == 7.0
@test convert_value("1 2 3") == [1, 2, 3]
@test convert_value("1.0 2 3") == Float64[1, 2, 3]
@test convert_value("true") == true
@test c... |
17e005453f678c0cd190adc0fab98e5e8e3ff83a2747a0311866b925de41df9a | Julia | 1,419 | 40 | gaas_poscar = string(@__DIR__) * "/../parse/test_files/POSCAR_gaas"
@testset "Basis GaAs" begin
conf = get_empty_config()
set_value!(conf, "orbitals", "Ga", "sp3dr2 sp3dr2 sp3dr2 sp3dr2")
set_value!(conf, "orbitals", "As", "sp3dr2 sp3dr2 sp3dr2 sp3dr2")
set_value!(conf, "n", "Ga", 3)
set_value!(con... |
3567d6045c4b49b974a6ce0bdcaac2aa8df0c15c7e428a217d18f62b294b6bd7 | Julia | 1,424 | 33 | path = string(@__DIR__) * "/test_files/"
@testset "EffectiveHamiltonian for PC" begin
conf = get_empty_config()
set_value!(conf, "poscar", joinpath(path, "POSCAR_gaas"))
set_value!(conf, "orbitals", "Ga", "sp3dr2 sp3dr2 sp3dr2 sp3dr2")
set_value!(conf, "orbitals", "As", "sp3dr2 sp3dr2 sp3dr2 sp3dr2")
... |
47835200840f761936b3640c67ab201649affbb79dc10cc58bdf09f7688105ee | Julia | 1,535 | 35 | @testset "Standard PC calculation" begin
path = joinpath(@__DIR__, "test_files")
conf = get_config(filename = joinpath(path, "hconf_std"))
set_value!(conf, "poscar", joinpath(path, "POSCAR_gaas"))
set_value!(conf, "rllm_file", joinpath(path, "rllm.dat"))
set_value!(conf, "kpoints", joinpath(path, "E... |
caae7365829e9618c72fa1297e07ea5bbf7c2902bd5d535e53c94c993c5a34dd | Julia | 1,541 | 45 | test_file_path = string(@__DIR__) * "/test_files/"
@testset "Methods" begin
# Test 1: Test nearest neighbors
poscar = Hamster.read_poscar(test_file_path*"POSCAR_CsPbBr3")
strc = Structure(poscar_path=test_file_path*"POSCAR_CsPbBr3")
rs_ion = Hamster.get_ion_positions(strc.ions)
Ts = Hamster.frac_... |
efa740441418e8b92cb6897ecbc0be1658ad953a0ace4f24ea4fc6fa3aeb1acf | Julia | 1,572 | 46 | """
read_hrdat(file::String)
Read a Wannier90 `hr.dat` file and extract the Hamiltonian matrix elements, lattice vectors, and degeneracy values.
# Arguments
- `file::String`: The path to the `hr.dat` file.
# Returns
- A tuple containing:
- `Hᴿ::Array{ComplexF64, 3}`: The Hamiltonian matrix elements, a 3D array... |
c276e283764d234a24690258b03feeb846c63833afa670c90366d05d1ccb491b | Julia | 1,594 | 53 | """
Abstract type `SparsityMode` serves as a base for indicating the sparsity of matrices.
These types enable dispatching based on the sparsity mode.
# Subtypes
- `Sparse <: SparsityMode`: Represents matrices with sparse storage.
- `Dense <: SparsityMode`: Represents matrices with dense storage.
"""
abstract type Spar... |
ebf6e24b795fbb4bd767228f9ad732cad43f016c6f6c8c615f128f8be66d6b27 | Julia | 1,596 | 42 | angular_parts = [Hamster.s(), Hamster.px(), Hamster.py(), Hamster.pz(), Hamster.dyz(), Hamster.dxz(), Hamster.dxy(), Hamster.dz2()]
radial_parts = [Hamster.R1(11.), Hamster.R2(11.), Hamster.R3(11.), Hamster.R4(11.), Hamster.R5(11.), Hamster.R6(11.)]
function not_nan_at_zero(angular_parts, radial_parts)
r0 = zeros(... |
48959e2c392f79551c6969c0ec0f91dc5b93669217f1e3f890aac41bd507aca9 | Julia | 1,612 | 26 | # ====================
# ML defaults
# ====================
@configtag model Bool haskey(conf,"ML") "whether ML model is used." "ML"
@configtag update Bool decide_ml_update(conf) "optimization of ML parameters" "ML"
@configtag init_params String "zeros" "initialization of ML parameters." "ML"
@configtag filename String... |
f376aa02cbe0f7ce82c41289c93b9f9e1bcb0708928ac6d35ad38ff841908201 | Julia | 1,632 | 48 | module Utils
using MultivariateStats, LinearAlgebra, Statistics, Plots
export pearson_corr_upper_tri, pca, max_normalization
# Computes the Pearson correlation between the upper triangular elements (excluding the diagonal) of two square matrices A and B.
function pearson_corr_upper_tri(A::AbstractMatrix, B::Abstract... |
0b45521baf47a3eabd782e3674c58c96c7826f647967992c60e6c925e236cfdc | Julia | 1,636 | 47 | using Statistics: mean
using Test: @test, @testset
using MAT: matread
using HiddenMarkovModels: logdensityof
using ZebrafishHMM2023: artr_wolf_2023, load_artr_wolf_2023, artr_wolf_2023_mat, HMM_ARTR,
artr_wolf_2023_temperatures, artr_wolf_2023_fishes, easy_train_artr_hmm
@testset "artr_wolf_2023" begin
for tem... |
6774467d70c0fb15a41e552f3c6dad060b216ac596e0422304b77792526f199a | Julia | 1,637 | 40 | """
read_eigenval(file::AbstractString, nmax::Int=1000000)
Read the `EIGENVAL` VASP output file and extract the k-points, energy bands and occupancies.
# Arguments
- `file::AbstractString`: The path to the `EIGENVAL` file.
- `nmax::Int=1000000`: The maximum number of bands to read. Default is 1,000,000.
# Return... |
18fad84c0b2c7d33603813ccc9c14920663313a12345e9f1b3c36d4a9fc9fa6e | Julia | 1,684 | 50 | #= Dataset from Le Goc et al 2021, as prepared by Matteo.
Originally from https://datadryad.org/stash/dataset/doi:10.5061/dryad.3r2280ggw, also
https://gitlab.com/GuillaumeLeGoc/thermomasterlab =#
function behaviour_free_swimming_hdf5_path()
return joinpath(artifact"behaviour_free_swimming", "behaviour_free_swimmin... |
e939197c7be46e357fc3875abd83eadd6fc1bfac5720bded059f91e8e1ee9caa | Julia | 1,686 | 74 | using Microstructure
using Test
axon = Cylinder(; da=2.0e-6)
extra = Zeppelin()
iso = Iso()
sphere = Sphere()
bval = [1000, 2500, 5000, 7500, 11100, 18100, 25000, 43000] .* 1.0e6
techo = 40.0 .* ones(8) .* 1e-3
tdelta = 15.129 .* ones(8) .* 1e-3
tsmalldel = 11.0 .* ones(8) .* 1e-3
prot = Protocol(bval, techo, tdelta,... |
6c75c9212a8c6067d10cb097e9d318a70a431e0f09c547fb6b09c0bacb5b7f57 | Julia | 1,717 | 40 | """
parse_commandline(args::Vector{String}) -> Dict{String, String}
Parses command-line arguments from a vector of strings `args` and returns a dictionary of parsed arguments.
# Arguments
- `args`: A vector of command-line arguments passed as strings.
# Behavior
- Keyword arguments (`--option`): If an argument s... |
dd0a5c1e9f2764a8762068f7cfcc598e6dc9c3901c65cc5d192f5e574d56281c | Julia | 1,722 | 57 | using Documenter, Microstructure
push!(LOAD_PATH, "../src/")
mathengine = MathJax3(
Dict(
:loader => Dict("load" => ["[tex]/require", "[tex]/mathtools"]),
:tex => Dict(
"inlineMath" => [["\$", "\$"], ["\\(", "\\)"]],
"packages" => ["base", "ams", "autoload", "mathtools", "r... |
adbe73395c96dc651895d7d0e7ac83939d157ae8609e4659bb0e6bead49ad9f0 | Julia | 1,766 | 46 | """
Abstract type `SparsityMode` serves as a base for indicating the sparsity of matrices.
These types enable dispatching based on the sparsity mode.
# Subtypes
- `Sparse <: SparsityMode`: Represents matrices with sparse storage.
- `Dense <: SparsityMode`: Represents matrices with dense storage.
"""
abstract type Spar... |
845e770fb6fae10cbefb51dc8550ab58b60099c2b8a50397c73ea5c2bc53e0ae | Julia | 1,819 | 69 | #!/usr/bin/env julia
include("PassiveCable.jl")
using JSON
using Unitful
using Unitful.DefaultSymbols
using Main.PassiveCable
scale(quantity, unit) = uconvert(NoUnits, quantity/unit)
# This should run the same effective model
# as rallpack1, but with differing
# electrical parameters (see below).
function run_cabl... |
01d5d03df2e71f3d4388a53f4f9601e916f80102c65aff77d42d4b3e3d92b106 | Julia | 1,835 | 69 | using LinearAlgebra
using LinearMaps
using MAT
using SparseArrays
using Arpack
using PyCall, SparseArrays
function scipyCSC_to_julia(A)
m, n = A.shape
colPtr = Int[i+1 for i in PyArray(A."indptr")]
rowVal = Int[i+1 for i in PyArray(A."indices")]
nzVal = Vector{Float64}(PyArray(A."data"))
B = Spars... |
8df361726ca01f2b5f4abac26de58a8629f8eddae34def82e6883153380d9bb1 | Julia | 1,859 | 43 | @testset "Random search hyperparameter optimization" begin
path = joinpath(@__DIR__, "test_files")
conf = get_config(filename = joinpath(path, "hconf_hyperopt"))
set_value!(conf, "poscar", joinpath(path, "POSCAR_gaas"))
set_value!(conf, "train_data", "Optimizer", joinpath(path, "EIGENVAL_gaas"))
pr... |
fa7c5fbeb1cc6d97cafa148b79cd53cc17e4b0f27c64ebd193379df915737f00 | Julia | 1,964 | 58 | #= ARTR neural data from Wolf et al 2023 =#
function artr_wolf_2023_folder(temperature::Int)
return @artifact_str("Wolf_ARTR_2023_T$temperature")
end
artr_wolf_2023_temperatures() = (18, 22, 26, 30, 33)
function artr_wolf_2023_temperatures(fish::Int)
return [temperature for temperature = artr_wolf_2023_temper... |
c7a561416fa8396f978a21e2de2f18f51a35bb6ca397ab2b89ba248334c353f9 | Julia | 2,003 | 58 | ##
using Pkg
script_dir = @__DIR__ # Get the directory of the current script
project_root = joinpath(script_dir, "..", "..", "..") # Get the path to the parent directory (the project root)
Pkg.activate(project_root) # Activate the project
#Pkg.instantiate() # download all the required packages
using LinearAlgebra, Sta... |
5d07e2effc100af4a3b005de7dbe8260158bf8eb15f96a243e2b26a248a1f070 | Julia | 2,015 | 76 | using Pkg
Pkg.activate("/SEC/ZebraFish/Tools_Analysis/ZebrafishHMM_EntropyPaper/Julia_code/")
using HiddenMarkovModels: viterbi
using HDF5
using ZebrafishHMM2023: load_hmm, HMM_ARTR_Log
# using Statistics: mean, std, var
# using ZebrafishHMM2023: load_artr_wolf_2023, HMM_ARTR_Log, normalize_transition_matrix, ATol, vit... |
728feaa7f054d5c1fe89b0079ea6229700244fb7def79d6d7f99fc8319171530 | Julia | 2,033 | 67 | """
half_normal_fit(S1, S2)
Fits a truncated normal distribution to data, where S1 = <x> and S2 = <x^2> are empirical
moments. The truncation interval is fixed to [0, ∞).
"""
function half_normal_fit(S1::Real, S2::Real; maxiter=1000, atol=1e-10, rtol=1e-10, γ=1e-10)
S1 > 0 && S2 > 0 || throw(ArgumentError("S1,... |
5c1b7db4c610b6ed0dcff516cf0617ce202ac2738785f9a2593dd93040f0c608 | Julia | 2,062 | 48 | @testset "Simple Universal Model" begin
path = joinpath(@__DIR__, "test_files")
strc_file = joinpath(path, "strc_file.h5")
eig_file = joinpath(path, "eig_file.h5")
if isfile(strc_file); rm(strc_file); end
if isfile(eig_file); rm(eig_file); end
poscar_gaas = Hamster.read_poscar(joinpath(pat... |
472699030f870a287ead5095c4858d4cb31f41ab3776fec71cb4695e99079e56 | Julia | 2,067 | 58 | using Test: @inferred
using Test: @test
using Test: @test_broken
using Test: @testset
using ZebrafishHMM2023: chunks
using ZebrafishHMM2023: equal_partition
using ZebrafishHMM2023: find_repeats
using ZebrafishHMM2023: makechunks
using ZebrafishHMM2023: split_into_repeated_subsequences
@testset "chunks" begin
@test... |
4f3aad9462a521f238a3282ab99435a7dbac4125841fcff4070863b476b8bd4a | Julia | 2,084 | 62 | """
baseorb logic
The baseorb of px, py, pz should be the same since since one can transform one into
the other by rotation.
"""
function get_base_orb(base::Tuple{A1, A2}) where {A1,A2<:Angular}
base = get_base_orb.(base)
#if base[1].l > base[2].l && base[1].l ≥ 0 && base[2].l ≥ 0; return (base[2], base[1... |
c695645b796aac0520809fce1e8b80e9a24d57f8f2444927d6158e3596475542 | Julia | 2,089 | 35 | ##
using Pkg
script_dir = @__DIR__ # Get the directory of the current script
project_root = joinpath(script_dir, "..", "..") # Get the path to the parent directory (the project root)
Pkg.activate(project_root) # Activate the project
Pkg.instantiate() # download all the required packages
using DelimitedFiles, Plots
##... |
351f97faed5a9569098bd819c6811f22cca47b9c19202021e12ed91a313922cd | Julia | 2,121 | 71 | function mean_square_reorientation(δθs::AbstractVector, q::Int)
return mean(abs2, sum(δθs[i:(i + q)]) for i = 1:(length(δθs) - q))
end
# filter observation sequence according to some condition `cond`
function filter_obs(cond, obs_seq::AbstractVector, state_marginals::AbstractVector)
_idx = findall(cond, obs_se... |
15b37d2899337ee0f9b03907cf2b79f6e0d4096871a19bbf29234f074137a232 | Julia | 2,218 | 71 | #=
Two-state model, L and R.
=#
mutable struct ZebrafishHMM_G2_Sym <: HiddenMarkovModels.AbstractHMM
pinit_L::Float64
pturn::Float64
turn::Gamma{Float64}
function ZebrafishHMM_G2_Sym(pinit_L::Real, pturn::Real, turn::Gamma)
return new(pinit_L, pturn, turn)
end
end
# number of hidden states
... |
090a363cc13c011db62314d5fb00d3063c123924699d58df666fcfbda8fc50aa | Julia | 2,255 | 42 | #––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––#
# MACAQUE VS MARMOSET - DISTRIBUTED WORKING MEMORY #
#––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––#
#––––––––––––––––––––––––––––––––––––––––––––––––––––#
# ... |
f2119e28b7f0e5bba661c4aae2e88369270ee0c97840fc8e92e5bfe1cc6173ad | Julia | 2,279 | 79 | module ZebrafishHMM2023
import CairoMakie
import DataFrames
import DensityInterface
import HiddenMarkovModels
import LazyArtifacts
import Makie
import Random
import StatsAPI
import StatsBase
using HiddenMarkovModels: viterbi
using DensityInterface: logdensityof
using Distributions: AffineDistribution
using Distributio... |
1d530d86c9b30896057ef3991eb050f5d5e97be128e18052f6001eac40a65b5a | Julia | 2,312 | 72 | element_to_number(element)::UInt8 = elements[Symbol(element)].number
number_to_element(number) = elements[number].symbol
"""
struct Poscar
A structure to represent the data contained in a VASP POSCAR file.
# Fields
- `a::Float64`: The scaling factor.
- `lattice::Array{Float64, 2}`: A 3x3 array representing the l... |
749c3fe2a7e2e56ce3f8f3d82c93601ca52338f083f0167afb41fd4d744d064d | Julia | 2,315 | 64 | using MAT: matread
using Statistics: mean
using Test: @test, @testset
using ZebrafishHMM2023: artr_wolf_2023
using ZebrafishHMM2023: artr_wolf_2023_distances
using ZebrafishHMM2023: artr_wolf_2023_distances_file
using ZebrafishHMM2023: artr_wolf_2023_fishes
using ZebrafishHMM2023: artr_wolf_2023_mat
using ZebrafishHMM2... |
7d8ae6edf2efeb67843579acca456a8c3fc360d9179400fb4e6b95cfa038663d | Julia | 2,374 | 65 | @testset "Config" begin
conf = Hamster.get_empty_config()
# Test convert value
convert_value = Hamster.convert_value
@test convert_value("7.0") == 7.0
@test convert_value("1 2 3") == [1, 2, 3]
@test convert_value("1.0 2 3") == Float64[1, 2, 3]
@test convert_value("true") == true
@test c... |
27646d7f7fbd39299a8db6d6f200e6a1f5896e468f4c3e2a42fa9c29e1a41d92 | Julia | 2,389 | 72 | """
get_index_to_ion_orb_map(Norb) -> Vector{Tuple{Int64, Int64}}
Generate a mapping from basis state indices to corresponding ion and orbital indices.
# Arguments:
- `Norb`: A vector where each element represents the number of orbitals associated with each ion.
# Returns:
- `index_map`: A vector of tuples wher... |
ecbb923c9e4981b2a030242fa5573e9664bf1482538d40546dccb2d71f91833c | Julia | 2,398 | 73 | ### A Pluto.jl notebook ###
# v0.19.46
using Markdown
using InteractiveUtils
# ╔═╡ c31f2000-f2a7-43e0-9cc3-28cc64ab92cb
import Pkg, Revise; Pkg.activate(Base.current_project())
# ╔═╡ f6fcf6cc-83b0-4356-b670-743d32c4e95c
using Statistics: mean
# ╔═╡ 059837ce-df90-4e34-93cf-b5caa8896c26
using Distributions: Normal
#... |
ad9c28e860ea79eaba22184962d64c5131ecc1bf06c9be9f3726394332b1184e | Julia | 2,415 | 66 | gaas_poscar = string(@__DIR__) * "/../parse/test_files/POSCAR_gaas"
@testset "TB Model GaAs" begin
conf = get_empty_config()
set_value!(conf, "orbitals", "Ga", "sp3dr2 sp3dr2 sp3dr2 sp3dr2")
set_value!(conf, "orbitals", "As", "sp3dr2 sp3dr2 sp3dr2 sp3dr2")
set_value!(conf, "n", "Ga", 3)
set_value!(... |
9990c94575c7b33ccfa44e8f942a6947224a0842b2f60e36a12bf9e1ea5f8646 | Julia | 2,445 | 50 | """
GDOptimizer
A gradient descent optimizer for training Hamiltonian models, incorporating loss functions, regularization, and an Adam optimizer for parameter updates.
# Fields
- `loss::Loss`: The loss function used for training. Determines how the model's error is measured and minimized during training.
- `val_... |
d6171f43a22b4c9792c2a9c679d905c9867710889e33c5c755b258312203cd01 | Julia | 2,459 | 55 | import Hamster: parse_commandline
@testset "CLI tests" begin
# Test 1: Positional arguments only
args1 = parse_commandline(["Hello", "World"])
@test args1["pos_arg_1"] == "Hello" && args1["pos_arg_2"] == "World"
# Test 2: Boolean flag argument
args2 = parse_commandline(["build", "-v"])
@test a... |
7557304d702f0865be512d6c71f72629643a7896a72ca4095a63ebbc073a5289 | Julia | 2,518 | 59 | #
# Orbital / basis config
#
@configtag onsite Bool true "use separate parameters for onsite matrix elements."
@configtag sepNN Bool false "use separate parameters for nearest-neighbor interactions. This can improve accuracy, however, may at the same time affect transferability negatively."
"""
**orbitals**=[]
The `o... |
0911132d5bfd3dd75bee01843b80ae8db767a629089e1655b4f4633d21c0a769 | Julia | 2,539 | 86 | # Kai Sandbrink, building off script by Johanni Brea
# 2022-10-22
# This script solves the Infobandit POMDP - OvB Style, for a given bias phi, using exponential decay of efficacy [binned up to 5 states] of given speed k, probabilistic readout observation
using Pkg; Pkg.activate("."); Pkg.instantiate()
Pkg.add(["POMDPT... |
bfa534e5917c42164237fb3cecacdd00960d386f2d18a1fc2b4260ee7021ab52 | Julia | 2,552 | 90 | """
**params**=[""]
The `params` tag defines the hyperparameters to be optimized.
For parameters belonging to a specific block, use the syntax `block_param`.
"""
function get_hyperopt_params(conf::Config)::Vector{String}
if conf("params", "HyperOpt") == "default"
return String[]
else
if co... |
0974d97cd249062c0e59b23defdb7212b10e630f4dad7863bbf2a870cbf0204c | Julia | 2,554 | 40 | gaas_poscar = string(@__DIR__) * "/../parse/test_files/POSCAR_gaas"
cspbbr_poscar = string(@__DIR__) * "/../strc/test_files/POSCAR_CsPbBr3"
@testset "GaAs overlaps" begin
conf = get_empty_config()
set_value!(conf, "orbitals", "Ga", "sp3dr2 sp3dr2 sp3dr2 sp3dr2")
set_value!(conf, "orbitals", "As", "sp3dr2 s... |
63fd77bc7c7dbfb8daf0003c819d31a020f96ce65ff6c20906726f5ac78fc5ef | Julia | 2,585 | 81 | """
Nconf=10
The `Nconf` tag sets the number of samples that are sampled from the total number of configuration.
"""
get_Nconf(conf::Config)::Int64 = get(conf, "Nconf", "Supercell", 1)
"""
Nconf_min=10
The `Nconf_min` tag sets the minimum index that can be sampled from the total number of configurations.
"""... |
ed1c8859e21484db7494d703f89c1ac3ae8575aa478b5889beb452bf025769dd | Julia | 2,598 | 84 | module DMDUtils
using LinearAlgebra
# build a Hankel (time-delay) embedding
function hankel_embed(data::AbstractMatrix, delays::Integer, stride::Integer)
n, T = size(data)
m = T - (delays - 1) * stride
@assert m ≥ 2 "Not enough snapshots for delays=$delays and stride=$stride."
H = similar(data, n * de... |
49d46338da7d5d68e5bb5df0a873147aab771318bc16dc48bfaea7e54f074fef | Julia | 2,622 | 72 | """
read_xdatcar(xdatcar::AbstractString) -> Xdatcar
Read the configurations in the `xdatcar` file and store them in an `Xdatcar` object.
# Arguments
- `xdatcar::AbstractString`: The path to the XDATCAR file.
- `frac::Bool=true`: If false, coordinates are transformed to cartesian from fractional.
- `verbosity::In... |
5fcdd2abd6aa79b79b13456a0f871c5e80263e094e0848cd8645dc64f87e8dec | Julia | 2,634 | 66 | @testset "Ion" begin
# Test 1: Creation of an Ion instance
ion = Ion(Hamster.element_to_number("Na"), SVector{3}(1.0, 2.0, 3.0), SVector{3}(0.1, 0.1, 0.1))
@test ion.type == Hamster.element_to_number("Na")
@test ion.pos == SVector{3}(1.0, 2.0, 3.0)
@test ion.dist == SVector{3}(0.1, 0.1, 0.1)
... |
b289e20a9498b694a2229c478e74ed072dfcf093cecd05d50c7f12984347afc0 | Julia | 2,639 | 68 | import Makie
import CairoMakie
using HiddenMarkovModels: logdensityof, baum_welch, transition_matrix, initial_distribution, viterbi
using Statistics: mean
using Test: @test, @testset
using ZebrafishHMM2023: load_artr_wolf_2023, HMM_ARTR_Log, normalize_transition_matrix, ATol, viterbi_artr
using DelimitedFiles: writedl... |
900f4c94637863559b1006cd92c028a3bde97558dd063a8e600876e901b4b0bf | Julia | 2,681 | 88 | ### A Pluto.jl notebook ###
# v0.20.0
using Markdown
using InteractiveUtils
# ╔═╡ 9611b800-e29b-4126-8857-03501df2de90
import Pkg, Revise; Pkg.activate(Base.current_project())
# ╔═╡ cf3f8b50-f15c-4085-bb6b-0fece67756cb
using Statistics: mean, std, cor
# ╔═╡ fae587e7-18fb-4e22-8079-5fec057e3465
md"# Imports"
# ╔═╡ ... |
de7f879bf0ab4dad2caff29aa2692fd5e4d45f1b6c4b0f40f40dca8e23951b16 | Julia | 2,700 | 61 | module Hamster
using LinearAlgebra, SparseArrays, StaticArrays, KrylovKit, Dates, PeriodicTable, UnPack, MPI, Clustering, BlockDiagonals, DataStructures,
CubicSplines, HCubature, Statistics, ChunkSplitters, FiniteDiff, StatsBase, HDF5, Printf, OhMyThreads, TreeParzen, Arpack, Random
include("parse/utils.jl"); inc... |
50950ffa53ca50300f6bc882d6db3a2dfb5a2835bd7fda594dc5bb5136ec6d49 | Julia | 2,703 | 56 | test_file_path = joinpath(@__DIR__, "test_files")
@testset "Structure" begin
# Test 1: Create Structure from POSCAR
poscar = Hamster.read_poscar(joinpath(test_file_path, "POSCAR_CsPbBr3"))
strc = Structure(poscar_path=joinpath(test_file_path, "POSCAR_CsPbBr3"))
@test strc.lattice == poscar.lattice
... |
910f273972cc68dd0bc039ce628486e56abad2f0b6cd2a2595c858680abbbe26 | Julia | 2,713 | 65 | struct HMM_Eyes_ARTR_Only <: HiddenMarkovModels.AbstractHMM
pinit::Vector{LogFloat64} # initial state probabilities
transition_matrix::Matrix{LogFloat64} # T[y,z] = P(y -> z)
emit::Vector{NeuronsBinaryDistribution}
pseudocount::Float64
function HMM_Eyes_ARTR_Only(
pinit::AbstractVector{<:Re... |
0d77bfe2497be7d698f3faa42e507850e2b38a394dbd47df00cdf7381a1b9d28 | Julia | 2,738 | 48 | #––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––#
# MACAQUE VS MARMOSET - DISTRIBUTED WORKING MEMORY #
#––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––#
#––––––––––––––––––––––––––––––––––––––––––––––––––––#
# ... |
7817b1b087395be27f77047c4d89862da57cf8960b6f7e7b8a6c2d6d87f0c2db | Julia | 2,747 | 106 | # use with `include("datadeps.jl")` in your main script,
# then call `datadeps("vids1")` to get the path to the data
using DataDeps
using MD5
ENV["DATADEPS_LOAD_PATH"] = joinpath(dirname(Base.current_project()), "DataAndModels/")
ENV["DATADEPS_ALWAYS_ACCEPT"] = true
ENV["DATADEPS_NO_STANDARD_LOAD_PATH"] = true
if !i... |
31dbc789492802bbc8e6b38cd4520056ceb7924396a6344d3eb602978c5c0170 | Julia | 2,775 | 69 | import Hamster: get_transformed_system
# test if obtained system is orthonormal
function is_orthonormal(Ê; ε=1e-10)
e1 = Ê[1, :]; e2 = Ê[2, :]; e3 = Ê[3, :]
t1 = e1 ⋅ e2 < ε; t2 = e1 ⋅ e3 < ε; t3 = e2 ⋅ e3 < ε
t4 = 1 - ε < norm(e1) < 1 + ε
t5 = 1 - ε < norm(e2) < 1 + ε
t6 = 1 - ε < norm(e3) < ... |
52a5afafece29a1fe3603661ecc7931badd6222c1ff05ad997c00164c59a2082 | Julia | 2,842 | 90 | using ZebrafishHMM2023: load_behaviour_free_swimming_data, normalize_all!,
normalize_transition_matrix!,
load_behaviour_free_swimming_trajs,
ZebrafishHMM_G3, ZebrafishHMM_G4, ZebrafishHMM_TN03, ZebrafishHMM_TN04, ZebrafishHMM_TN04_Sym,
ZebrafishHMM_TN3, ZebrafishHMM_TN4, markov_equilibrium, stubborness_... |
63ac42a446f2cc81b7e1453b79401a20e3b0b16047bb17bb6761c6c93242ce18 | Julia | 2,850 | 94 | using ZebrafishHMM2023: load_behaviour_free_swimming_data, normalize_all!,
normalize_transition_matrix!,
load_behaviour_free_swimming_trajs,
ZebrafishHMM_G3, ZebrafishHMM_G4, ZebrafishHMM_TN03, ZebrafishHMM_TN04, ZebrafishHMM_TN04_Sym,
ZebrafishHMM_TN3, ZebrafishHMM_TN4, markov_equilibrium, stubborness_... |
5443da09fac9c07e8abe6a313e1214073f34ab70e6c63fea756c8b8975a5227c | Julia | 2,852 | 101 | using Hamster, Test, LinearAlgebra, SparseArrays, StaticArrays, HCubature, Statistics,
FiniteDiff, HDF5, TensorOperations, Suppressor, MPI, Logging, BlockDiagonals, DataStructures
MPI.Init()
comm = MPI.COMM_WORLD
rank = MPI.Comm_rank(comm)
nranks = MPI.Comm_size(comm)
args = Hamster.parse_commandline(ARGS)
test_all ... |
5510dc555c61415b27dbe2201f0d2a46ca8b24d49a857e75757bf620e0a9cac5 | Julia | 2,854 | 90 | """
init_params=zeros
The `init_params` tag determines how the parameters of the ML model are initialized.
"""
get_ml_init_params(conf::Config)::String = conf("init_params", "ML") == "default" ? "zeros" : conf("init_params", "ML")
"""
filename=ml_params
The `filename` tag sets the name for the parameter file... |
1d93de6987e67709f46dc446932308e58dc5f9dc0eaf0967c74babccba1829fd | Julia | 2,865 | 89 | ### A Pluto.jl notebook ###
# v0.19.46
using Markdown
using InteractiveUtils
# ╔═╡ 71410271-e1ce-4cb9-ae84-1649120f2a3d
import Pkg, Revise; Pkg.activate(Base.current_project())
# ╔═╡ 825689ff-4b29-4343-a9a9-13dc5b226384
using Statistics: mean
# ╔═╡ 1bcbcf6f-533b-4b26-b349-f30e2d437527
using Distributions: Gamma
# ... |
55fae7bba24d09108c2e70e042fe1910ce8e05e7ad2aca4f2859975ba3c12364 | Julia | 2,899 | 102 | using Hamster, Test, LinearAlgebra, SparseArrays, StaticArrays, HCubature, Statistics, Ewalder,
FiniteDiff, HDF5, TensorOperations, Suppressor, MPI, Logging, BlockDiagonals, DataStructures
MPI.Init()
comm = MPI.COMM_WORLD
rank = MPI.Comm_rank(comm)
nranks = MPI.Comm_size(comm)
args = Hamster.parse_commandline(ARGS)
t... |
ab5ef5944154be4467986c37bd2aee92dbbb9c3ed92680290c5e78f11497584d | Julia | 2,901 | 62 | module Hamster
using LinearAlgebra, SparseArrays, StaticArrays, KrylovKit, Dates, PeriodicTable, UnPack, MPI, Clustering, BlockDiagonals, DataStructures,
CubicSplines, HCubature, Statistics, ChunkSplitters, FiniteDiff, StatsBase, HDF5, Printf, OhMyThreads, TreeParzen, Arpack, Random,
FFTW, SpecialFunctions
in... |
e6c9dc586d2e79d3580959636b39c15c03523252220ff035ab4dee74ac706e4c | Julia | 2,907 | 78 | # ====================
# Supercell defaults
# ====================
@configtag Nconf Int64 1 "number of sample configuration." "Supercell"
@configtag Nconf_min Int64 1 "minimum configuration index for sample." "Supercell"
@configtag Nconf_max Int64 1 "minimum configuration index for sample." "Supercell"
@configtag nbatc... |
39ce80d1e8ce9f87569f301040f2273a711fe8509e11671affea57a61ad0a73d | Julia | 2,984 | 69 | # ====================
# Input/Output
# ====================
@configtag verbosity Int64 1 "Controls output verbosity (0=minimal, 1=normal, 2=verbose, 3=debug)."
@configtag h5_deflate Int64 0 "Deflate compression level used for HDF5 datasets. Valid values are 0-9, where 0 disables compression, 1 gives the fastest compre... |
98e266ed2f2b34989b01560337f335748446cba4b7fc8e24265df9a1ba048455 | Julia | 3,022 | 74 | """
get_eigenvalue_gradient(vs::Array{ComplexF64, 3}, Rs::Matrix{Float64}, ks::Matrix{Float64}) -> Array{Float64, 5}
Computes the gradient of energy eigenvalues with respect to the Hamiltonian matrix elements by performing explicit loops.
"""
function get_eigenvalue_gradient(vs::Array{ComplexF64, 3}, Rs::Matrix{Fl... |
95f53870fd31ff8cfb3cdc2131a58b256500cc223f7e7f039c39bfa2c3c40267 | Julia | 3,031 | 70 | function main(comm, conf; rank=0, nranks=1, num_nodes=1, verbosity=get_verbosity(conf))
# Clear output files from previous Hamster runs
clear_hamster_output()
# Create a temporary folder
if "tmp" in readdir(pwd()) && rank == 0; rm("tmp", recursive=true); end
if !("tmp" in readdir(pwd())) && rank ==... |
fe3094e61c9ed49c56ca19bad99783514d47d530ba3bf690aa5c1146225ac6dd | Julia | 3,067 | 88 | # Models
struct HMM_Gaze <: HiddenMarkovModels.AbstractHMM
transition_matrix::Matrix{LogFloat64} # T[y,z] = P(y -> z)
μ::Vector{Float64}
σ::Vector{Float64}
pinit::Vector{LogFloat64} # initial state probabilities
function HMM_Gaze(
transition_matrix::AbstractMatrix{<:Real},
μ::Abstra... |
e26ef5795ae5522b16c87357be2568fa208c80d9da742149a1c1deebe85bc071 | Julia | 3,073 | 110 | using Plots
using ProgressMeter
using Glob
using HDF5
using GaussianMixtures
using StatsBase
using Distributions
using NaNStatistics
using Random
Random.seed!(42)
# MAIN PATH
ZENODOPATH = "Your/Path/To/Zenodo/Data"
# FIGURE PATH
FIGPATH = "Your/path/to/figures"
# Hard-coded values used for the Nw Ww split
# Current... |
e9d479ef4d0b970fd6dc85ce356ac96c82ec0c5de9f9b8cedee3be12e3575ef3 | Julia | 3,170 | 101 | using Glob
include(joinpath(dirname(Base.current_project()), "datadeps.jl"))
using DataDeps: @datadep_str
# function load_models(dir::String, name::String)
# paths = glob("*$name*h5", dir)
# return paths
# end
#
# function load_model(dir::String, name::String)
# path = load_models(dir, name)
# @assert length(... |
ee1574ffc4dd7eb49ed3c77c4b1baf8b8c3b8bbf30f5f0971392a88d368b886f | Julia | 3,195 | 79 | @testset "Translation Vectors" begin
conf = Hamster.get_empty_config()
lattice = [2.825 0.0 2.825; 2.825 2.825 0.0; 0.0 2.825 2.825]
# Test 1: Default Rmax for rcut=0
Hamster.set_value!(conf, "rcut", "0.")
@test Hamster.get_Rmax(lattice, conf) == Hamster.get_Rmax(conf)
# Test 2: Rmax parameter... |
8bdd2fad0954928f1abe59751797c07c3ae950d98a7b7845c289b7e55bcb3c08 | Julia | 3,198 | 86 | @testset "IonLabel" begin
@test Hamster.IonLabel(5, 3).types == [3, 5] # types are sorted
@test Hamster.IonLabel(5, 3, sorted=false).types == [5, 3] # types are not sorted
@test Hamster.IonLabel("As", "Ga").types == [31, 33]
@test Hamster.IonLabel("As", "Ga") == Hamster.IonLabel("Ga", "As")
@test H... |
3446c8a399ed6015f05fd1ec8fc09c546c7fb88600a6bb6b1d9b98650ff7a11a | Julia | 3,264 | 106 | using ZebrafishHMM2023: normalize_all!, load_behaviour_free_swimming_trajs, ZebrafishHMM_TN03,
markov_equilibrium, stubborness_factor, ZebrafishHMM_TN04, FL_FR_canon!,
ZebrafishHMM_G4_Sym
using HiddenMarkovModels: baum_welch, logdensityof
using Distributions: Normal, Gamma
using Statistics: middle
using Test: @... |
dc897122d33299fd02b2bdbf5d3f845acad0dd9a4211af75b613a8adfd887e5c | Julia | 3,269 | 90 | @testset "HamiltonianKernel Tests" begin
# Define test inputs
ws = [0.5, 1.0, 1.5]
xs = [[1.0], [2.0], [3.0]]
σ = 0.1
# Test 1: test exp_sim function
@test Hamster.exp_sim([1.0], [1.0], σ=0.1) ≈ 1.0
@test Hamster.exp_sim([1.0], [2.0], σ=0.1) < 1.0
@test Hamster.exp_sim([1.0], [3.0],... |
cb7252d0024e45bdd5f9a94cb95cfee0157e432e0c98cc747edf74cae365b506 | Julia | 3,280 | 75 | function main(comm, conf; rank=0, nranks=1, num_nodes=1, verbosity=get_verbosity(conf))
# Clear output files from previous Hamster runs
clear_hamster_output()
# Create a temporary folder
if "tmp" in readdir(pwd()) && rank == 0; rm("tmp", recursive=true); end
if !("tmp" in readdir(pwd())) && rank ==... |
f6ecbe3ed20552789ec8afe221a2cdcc6ef80b423f2c32558e17b9409e88a12c | Julia | 3,290 | 78 | #––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––#
# MACAQUE VS MARMOSET - DISTRIBUTED WORKING MEMORY #
#––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––#
#––––––––––––––––––––––––––––––––––––––––––––––––––––#
# ... |
6ab56d5a947ab5be7eae596990cf14980900c24df21363224f42da16b464e564 | Julia | 3,293 | 94 | gaas_poscar = string(@__DIR__) * "/../parse/test_files/POSCAR_gaas"
cspbbr_poscar = string(@__DIR__) * "/../strc/test_files/POSCAR_CsPbBr3"
@testset "fcut function" begin
fcut = Hamster.fcut
# Test 1: r > rcut should return 0
@test fcut(2.0, 1.0) == 0.0
@test fcut(5.0, 3.0) == 0.0
# Test 2: r = ... |
7cd677cb77a5bdccfc62bb1fe7c0547fa3f43e5c43006c49b0887adc17a44209 | Julia | 3,328 | 97 | @testset "Hamiltonian I/O" begin
H_original = [rand(5,5), sprand(5,5,0.3)] # mix of dense and sparse
vecs_original = rand(3, 2)
write_ham(H_original, vecs_original, comm, rank; space="k")
H_loaded, vecs_loaded = read_ham(comm, rank; space="k")
H_loaded_2, vecs_loaded_2 = read_ham(rank; space=... |
97818cbd6e6541888c3c148565fc2c73624e1997237ce358cc469e9c827cc2f5 | Julia | 3,343 | 100 | ##
using Pkg
script_dir = @__DIR__ # Get the directory of the current script
project_root = joinpath(script_dir, "..", "..", "..") # Get the path to the parent directory (the project root)
Pkg.activate(project_root) # Activate the project
#Pkg.instantiate() # download all the required packages
using LinearAlgebra, Sta... |
716e23d0bffd88da4031b74699617af06f3c83ed76ba165dbbec2abcb0396ebc | Julia | 3,370 | 77 | @testset "Ion" begin
# Test 1: Creation of an Ion instance
ion = Ion(Hamster.element_to_number("Na"), SVector{3}(1.0, 2.0, 3.0), SVector{3}(0.1, 0.1, 0.1))
@test ion.type == Hamster.element_to_number("Na")
@test ion.pos == SVector{3}(1.0, 2.0, 3.0)
@test ion.dist == SVector{3}(0.1, 0.1, 0.1)
... |
c26d3efd3e8771ddc642680bb04393bd355f3d1cb4a3b225ab02d840b17d3fa1 | Julia | 3,454 | 153 | const ke = 14.3996454784255
@inline _wrap01(x) = x - floor(x)
@inline _sinc(x) = abs(x) < 1e-14 ? 1.0 : sin(x)/x
# cubic B-spline weights
# returns weights for offsets (-1, 0, 1, 2)
@inline function _bspline4_weights(t)
w0 = (1 - t)^3 / 6
w1 = (3t^3 - 6t^2 + 4) / 6
w2 = (-3t^3 + 3t^2 + 3t + 1) / 6
w3 ... |
faf297538b0fa780527b246aee5d700675da8e45c66a285c8e690fe9d27f6c3b | Julia | 3,469 | 105 | using Pkg
Pkg.activate(Base.current_project())
using HDF5
"""
strip_weight_maps!(dir::AbstractString; recursive=true, dry_run=false, keep_backup=false, verbose=true)
Rewrite every .h5/.hdf5 in `dir` **without** the top-level group "Weight Maps".
This actually frees disk space because files are rebuilt without tha... |
c1ef636827543f6576a8fad12922b9ff9690e5b38b31c9581a26369a8ac73387 | Julia | 3,499 | 146 | module PassiveCable
using Unitful: uconvert, NoUnits
export cable_normalize, cable, rallpack1
# Compute solution g(x, t) to
#
# ∂²g/∂x² - g - ∂g/∂t = 0
#
# on [0, L] × [0,∞), subject to:
#
# g(x, 0) = 0
# ∂g/∂x (0, t) = 1
# ∂g/∂x (L, t) = 0
#
# Parameters:
# x, t, L: as described above
# tol: ... |
fe8743adc6d5cf29c6a7b9bd3029cf5dd6d57c4a5d09aa2a1d6f5ea471ab727d | Julia | 3,533 | 55 | gaas_poscar = string(@__DIR__) * "/../parse/test_files/POSCAR_gaas"
cspbbr_poscar = string(@__DIR__) * "/../strc/test_files/POSCAR_CsPbBr3"
@testset "GaAs Orbitals" begin
conf = get_empty_config()
set_value!(conf, "orbitals", "Ga", "sp3dr2 sp3dr2 sp3dr2 sp3dr2")
set_value!(conf, "orbitals", "As", "sp3dr2 s... |
9eb10cf00af7276a552232425cd19fb2732f8ba5ee1490cda54815a5cdc0fad3 | Julia | 3,576 | 85 | @testset "Standard PC calculation" begin
path = joinpath(@__DIR__, "test_files")
conf = get_config(filename = joinpath(path, "hconf_std"))
set_value!(conf, "poscar", joinpath(path, "POSCAR_gaas"))
set_value!(conf, "rllm_file", joinpath(path, "rllm.dat"))
set_value!(conf, "kpoints", joinpath(path, "E... |
71b4896045d74ff84c0c7fc0ff2dd6f128d161adbbd11c68d0fa9248a4432cce | Julia | 3,612 | 88 | @testset "Push Points" begin
# Test 1: Adding a new grid point to an empty dictionary
grid_dict = Dict{SVector{3, Int64}, Vector{Int64}}()
grid_point = SVector{3, Int64}(1, 1, 1)
point_info = 1
Hamster.push_grid_point!(grid_dict, grid_point, point_info)
@test haskey(grid_dict, grid_point)
... |
38d40207d7cf6809069223eca2632eae24d44d8f868ee31c076a007a5cac7aae | Julia | 3,695 | 112 | ##
using Pkg
script_dir = @__DIR__ # Get the directory of the current script
project_root = joinpath(script_dir, "..", "..") # Get the path to the parent directory (the project root)
Pkg.activate(project_root) # Activate the project
Pkg.instantiate() # download all the required packages
using DelimitedFiles, Plots
#SE... |
12785ed7aecc91e3a349fa22bd9c73ad93c9b0de1c7eec3f0b6aaccb606d9a03 | Julia | 3,710 | 101 | @testset "HamiltonianKernel Tests" begin
# Define test inputs
ws = [0.5, 1.0, 1.5]
xs = [[1.0], [2.0], [3.0]]
σ = 0.1
# Test 1: test exp_sim function
@test Hamster.exp_sim([1.0], [1.0], σ=0.1) ≈ 1.0
@test Hamster.exp_sim([1.0], [2.0], σ=0.1) < 1.0
@test Hamster.exp_sim([1.0], [3.0],... |
895b1206e54e21efbb4a718ea65700a216adb780321a1b31e47741d097849356 | Julia | 3,710 | 108 | """
**onsite**=true
The `onsite` tag switches on the use of an extra parameter set for onsite interactions.
If false, onsite matrix elements are computed evaluating the distance-dependence function at `r=0`.
"""
get_onsite(conf::Config)::Bool = conf("onsite") == "default" ? true : conf("onsite")
"""
**sepNN**=false
... |
6a3275345a5d4c82bef709324be080cc15355d14d2f0f78e95db2bddf13d6627 | Julia | 3,728 | 126 | # Kai Sandbrink, building off script by Johanni Brea
# 2022-10-22
# This script solves the Infobandit POMDP - OvB Style, for a given bias phi, using exponential decay of efficacy [binned up to 5 states] of given speed k, probabilistic readout observation
using Pkg; Pkg.activate("."); Pkg.instantiate()
Pkg.add(["POMDPT... |
70e27c290fbd5feb060b677cb9a6122160b7a0bde2fd161a554146babec689ed | Julia | 3,732 | 100 | import CairoMakie
import Makie
using DelimitedFiles: writedlm
using Distributions: Normal
using HiddenMarkovModels: baum_welch
using HiddenMarkovModels: initial_distribution
using HiddenMarkovModels: logdensityof
using HiddenMarkovModels: transition_matrix
using HiddenMarkovModels: viterbi
using Statistics: mean
using ... |
d0744abd3abfc388ecf9d18517eb0548c864c84b6c912d3e7b451ee55c374e24 | Julia | 3,776 | 84 | @testset "GaAs SOC" begin
path = joinpath(@__DIR__, "test_files/")
conf = get_config(filename=joinpath(path, "hconf_gaas"))
set_value!(conf, "rllm_file", joinpath(path, "rllm_gaas.dat"))
set_value!(conf, "poscar", joinpath(path, "POSCAR_gaas"))
set_value!(conf, "init_params", joinpath(path, "params.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.