sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
d5fba3e441766e0538a3c451f94df4e4aee6a1276cb537577b18460dfc3588a8 | C/C++ | 15,528 | 504 | /*<html><pre> -<a href="qh-set_r.htm"
>-------------------------------</a><a name="TOP">-</a>
qset_r.h
header file for qset_r.c that implements set
see qh-set_r.htm and qset_r.c
only uses mem_r.c, malloc/free
for error handling, writes message and calls
qh_errex... |
f811f17788dbfe150ae3d34efdccc3bdd1913fc7772897cd0bc6ac91656b8275 | C/C++ | 15,889 | 388 | /*-
* Copyright 1997-1999, 2001, John-Mark Gurney.
* 2008-2009, Attractive Chaos <attractor@live.co.uk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must reta... |
5217ef2a584dd629c3dcc9fdcdb079ff21468d51342634045656e16e4acf2804 | C/C++ | 15,929 | 303 | /****************************************************************************
**
** Copyright (c) 2009-2018 C.B. Barber. All rights reserved.
** $Id: //main/2015/qhull/src/libqhullcpp/Coordinates.h#8 $$Change: 2549 $
** $DateTime: 2018/12/28 22:24:20 $$Author: bbarber $
**
**********************************************... |
870e6ef67d27359c3ba5158d83425d54228ee021838d71c0291b4b511696e560 | C/C++ | 16,389 | 514 | /**
******************************************************************************
* @file usbd_def.h
* @author MCD Application Team
* @brief General defines for the usb device library
******************************************************************************
* @attention
*
* Copyright... |
f14ed4b31bb3f0338cca8158f5c099a58a5eb43d9d4e09054eabf1f6286d332e | C/C++ | 17,307 | 317 | #pragma once
#include "hts_utils/FastxRandomReader.h"
#include "local_haplotagging.h"
#include "secondary/architectures/model_config.h"
#include "secondary/architectures/model_torch_base.h"
#include "secondary/common/batched_data.h"
#include "secondary/common/interval.h"
#include "secondary/common/interval_tree_types.... |
ff02ba59ab22bfac952e0e5f90cd7bd601f7fe9d6dbcb3da94a2fa73ba3cc68a | C/C++ | 19,890 | 490 | /* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32f4xx_hal_conf_template.h
* @author MCD Application Team
* @brief HAL configuration template file.
* This file should be copied to the application folder and renamed... |
5f0fdde20371f9b6d4cec892a56d94bad88b89b7d331a7fe23cb0624e62ece3a | C/C++ | 20,888 | 614 | /* The MIT License
Copyright (c) 2008, 2009, 2011 by Attractive Chaos <attractor@live.co.uk>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without ... |
74c2746c020a147bf1ab10610f28835c5f939b36c8a8fdcd2b9632c48acdd71b | C/C++ | 22,097 | 501 | #pragma once
#include "secondary/common/bam_file.h"
#include "secondary/features/medaka_read_matrix.h"
#include "types.h"
#include <cstdint>
#include <filesystem>
#include <memory>
#include <string>
#include <string_view>
#include <unordered_map>
#include <unordered_set>
#include <vector>
struct faidx_t;
struct bam1... |
597c80f0d9bcbc51933180846699039b86f4205d852f9a8118f5a3641fb132ff | C/C++ | 33,496 | 994 | /*<html><pre> -<a href="qh-user_r.htm"
>-------------------------------</a><a name="TOP">-</a>
user.h
user redefinable constants
for each source file, user_r.h is included first
see qh-user_r.htm. see COPYING for copyright information.
See user_r.c for sample code.
... |
effa4a8741b654c5ef2cfe15a0f89b7a556818dbf86c02138e853829ef115b8e | C/C++ | 37,862 | 492 | // Generated by using Rcpp::compileAttributes() -> do not edit by hand
// Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393
#ifndef RCPP_Scissor_RCPPEXPORTS_H_GEN_
#define RCPP_Scissor_RCPPEXPORTS_H_GEN_
#include <RcppEigen.h>
#include <Rcpp.h>
namespace Scissor {
using namespace Rcpp;
namespace {
... |
a4cd29a9e45a1bc2120e213198d75f754735305eb7c1559b6c61337d7260777e | C/C++ | 56,702 | 1,188 | /*<html><pre> -<a href="qh-qhull_r.htm"
>-------------------------------</a><a name="TOP">-</a>
libqhull_r.h
user-level header file for using qhull.a library
see qh-qhull_r.htm, qhull_ra.h
Copyright (c) 1993-2018 The Geometry Center.
$Id: //main/2015/qhull/src/libqhull_r... |
8b575dc3bb9e4326c8cec51d484fbbbc62b2f8add28c3d2802e179c893b5074c | JavaScript | 150 | 4 | document.addEventListener('DOMContentLoaded', function() {
// Custom JavaScript code can go here
console.log("Custom JavaScript loaded!");
}); |
9f4eee85a82d50ede2f9ef4d298a6f8b90da7d14cd7b03780bd85bd995574e3a | JavaScript | 1,681 | 62 | var min_ovlp = 30;
if (arguments.length < 3) {
print("Usage: k8 selctg.js <HLA-gene> <HLA-ALT-exons.bed> <ctg-to-ALT.sam> [min_ovlp="+min_ovlp+"]");
exit(1);
}
if (arguments.length >= 4) min_ovlp = parseInt(arguments[3]);
var gene = arguments[0];
var buf = new Bytes();
var h = {};
var file = new File(arguments[1]... |
1626706afc88d95ebe1173b553ec732c6dc82a576989315fdf5e7779af738a44 | JavaScript | 10,754 | 7 | /*!
* clipboard.js v2.0.4
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,func... |
f31cc9a181d1a23b137e2913647754b808bd909c1c2b7cd3c2b69a4d3ff7e8d4 | JavaScript | 16,856 | 496 | /*****************************************************************
* The K8 Javascript interpreter is required to run this script. *
* *
* Source code: https://github.com/attractivechaos/k8 *
* Binary: http://sourceforge.net/projects/lh3/fil... |
09e88c2cfaf23ea8a37b5681433eafea97033af632ecc948c8c1ee9944647743 | JavaScript | 17,320 | 7 | /*!***************************************************
* mark.js v8.11.1
* https://markjs.io/
* Copyright (c) 2014–2018, Julian Kühnel
* Released under the MIT license https://git.io/vwTVl
*****************************************************/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.e... |
5648b6830f88f9a04a1682110e9e16ac95dd093d7aa8d070aa9686955a634fc1 | JavaScript | 17,976 | 524 | /*****************************************************************
* The K8 Javascript interpreter is required to run this script. *
* *
* Source code: https://github.com/attractivechaos/k8 *
* Binary: http://sourceforge.net/projects/lh3/fil... |
ef4e11c157b1e2e89782d30bd726f2d5ff7834ea5e26ad02474325f8b1f126c9 | JavaScript | 18,051 | 10 | /**
* elasticlunr - http://weixsong.github.io
* Lightweight full-text search engine in Javascript for browser search and offline search. - 0.9.5
*
* Copyright (C) 2017 Oliver Nightingale
* Copyright (C) 2017 Wei Song
* MIT Licensed
* @license
*/
!function(){function e(e){if(null===e||"object"!=typeof e)return e... |
a59150dfe303fd80cae2e2a2915f4aa58a390eabd4ac2483897136ff593306d4 | JavaScript | 18,164 | 437 | (async function () {
"use strict";
/* ───────── Load schema & defaults ───────── */
const schemaResp = await fetch("../pipeline/default_params_schema.json");
const schema = await schemaResp.json();
let defaultParams;
try {
const defResp = await fetch("../pipeline/default_params.json");... |
401dd78f5dc740ba987ae9aaffa86c9f0c5b9889b1fed7adf30d5078665fe2a4 | JavaScript | 20,094 | 555 | 'use strict';
/* global Mark, elasticlunr, path_to_root */
window.search = window.search || {};
(function search() {
// Search functionality
//
// You can use !hasFocus() to prevent keyhandling in your key
// event handlers while the user is typing their search.
if (!Mark || !elasticlunr) {
... |
869b677373e8bc3c392c965baa5ee51b5863d391c3cba6bfc93a284726945deb | JavaScript | 26,681 | 446 | // Populate the sidebar
//
// This is a script, and not included directly in the page, to control the total size of the book.
// The TOC contains an entry for each page, so if each page includes a copy of the TOC,
// the total size of the page becomes O(n**2).
class MDBookSidebarScrollbox extends HTMLElement {
cons... |
a0b12cfedf44851aa23bbfd6c39a0df8f9c34fdb919d6d22913dcd2041d0b2fa | JavaScript | 30,019 | 843 | 'use strict';
/* global default_theme, default_dark_theme, default_light_theme, hljs, ClipboardJS */
// Fix back button cache problem
window.onunload = function() { };
// Global variable, shared between modules
function playground_text(playground, hidden = true) {
const code_block = playground.querySelector('cod... |
dc1325168ae9730198c20f5ffd55ed2fee9dca67014589ead7c6871e65521439 | JavaScript | 120,319 | 9 | /* ajv 8.17.1 (ajv7): Another JSON Schema Validator */
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).ajv7=e()... |
abc7f01d0ce8c64e4ba9e131d651e48ae1a567b2a1254fea8aab03502288de58 | JavaScript | 137,537 | 54 | /*
Highlight.js 10.1.1 (93fd0d73)
License: BSD-3-Clause
Copyright (c) 2006-2020, Ivan Sagalaev
*/
var hljs=function(){"use strict";function e(n){Object.freeze(n);var t="function"==typeof n;return Object.getOwnPropertyNames(n).forEach((function(r){!Object.hasOwnProperty.call(n,r)||null===n[r]||"object"!=typeof n[r... |
bba7c79255c5264c820f6252e8f6f6dcda8174a5ef76144d78f3181dd78c66bf | JavaScript | 200,912 | 1 | window.search = Object.assign(window.search, JSON.parse('{"doc_urls":["quick_start.html#basic-usage","quick_start.html#modkit-is-a-bioinformatics-tool-for-working-with-modified-bases-from-oxford-nanopore","quick_start.html#installation","quick_start.html#common-use-cases","quick_start.html#notes-and-troubleshooting","i... |
52b396e146231979454b9c248da765bd68e3edbe2c47d0f4c9abda120b265682 | Julia | 292 | 8 | abstract type AbstractSettings end
abstract type AbstractNetwork end
abstract type AbstractNode end
abstract type AbstractPopulation end
abstract type AbstractInputDynamics end
abstract type AbstractInput end
abstract type AbstractInternalDynamics end
abstract type AbstractOutputDynamics end |
a0693fb50f0afb4dfbf4d48a7691ef54340a56aa5855ba1ff6cd7b6e974ec99a | Julia | 600 | 20 | using Test
using ENEEGMA
@testset "Measurement Noise Bands" begin
settings = ENEEGMA.create_default_settings()
ds = settings.data_settings
ls = settings.optimization_settings.loss_settings
ds.measurement_noise_mode = "node_specific"
ds.measurement_noise_bands = Dict(
"C" => [[40.0, 45.0]],... |
e6312f71a9912b3d455586f7efdc8a61dc2afbeb539bdeb89aa8e475c6d2026e | Julia | 789 | 25 | using Test
using Random
using ENEEGMA
using Optimization
using OptimizationEvolutionary
@testset "CMA-ES callback loss and parameter alignment" begin
objective(x, _) = (x[1] - 0.75)^2
problem = OptimizationProblem(
OptimizationFunction(objective), [0.0]; lb=[-2.0], ub=[2.0],
)
records = Tuple{F... |
399c15d62fec407f2ce01d347d226ccb8895bd734c0fb1e2dcbce63b13a50107 | Julia | 1,245 | 48 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# FitzHugh-Nagumo oscillator
# Brain source: x1 / v.
# ---------------------------------------------... |
f1cc2fd008a514e8cd9a4eac01258462785ff793aa9ff8b9c8f541094c30a1b9 | Julia | 1,286 | 30 | using Test
using ENEEGMA
@testset "Montbrio population" begin
settings = ENEEGMA.create_default_settings()
settings.general_settings.path_out = mktempdir()
settings.general_settings.save_model_formats = String[]
settings.general_settings.make_plots = false
settings.general_settings.verbosity_level ... |
80594eb58eef8c8e649831f1e73e7e00f575caad781e695786eab1b12a985f97 | Julia | 1,305 | 43 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Van der Pol oscillator
# Brain source: oscillator displacement x, matching the canonical ENEEGMA n... |
05f6239fead30eff183c26fd4fe7858a8933fb40bffc7ad1aef0e7518e4fee19 | Julia | 1,319 | 48 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# Duffing oscillator equations
function f!(du, u, p, t)
δ, α, β, γ, f = p
x1, x2 = u
du[1] = x2
du[2] = -δ*x2 - α*x1 - β*x1^3 + γ*cos(2*π*f*t)
end
# Parameters
# ... |
1befcfce7060e962126cf0b0be206acf7f0d7a1222ed561ff11b93aa2f281a80 | Julia | 1,352 | 26 | using Test
using ENEEGMA
@testset "Settings matrix serialization preserves row orientation" begin
settings = ENEEGMA.create_default_settings()
settings.network_settings.n_nodes = 2
settings.network_settings.node_names = ["N1", "N2"]
settings.network_settings.node_models = ["MPR", "MPR"]
settings.ne... |
4763879c834636ce14ceafca119f1bbb731fb4e64280dbbfe652e70cc976ad08 | Julia | 1,388 | 44 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Stuart-Landau oscillator
# Brain source: real component x, matching the canonical ENEEGMA node def... |
52c108ad46748bbf35ac62d4ff7dde820daa32ee5525e641b0d281fcf0ac0b7c | Julia | 1,427 | 37 | using Test
using ENEEGMA
@testset "generated differential problems remain isolated" begin
first_problem = ENEEGMA.make_sde_problem_from_strings(
["-a*x"], ["sigma"], [:x], [:a, :sigma], [1.0], (0.0, 1.0),
(a=2.0, sigma=0.25),
)
second_problem = ENEEGMA.make_sde_problem_from_strings(
... |
f03942a9cc4563096664b1c328fbfee2202b254b9463975bcd67b7e3c57c8dab | Julia | 1,628 | 56 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Harmonic oscillator
# Brain source: displacement x, matching the canonical ENEEGMA node definition... |
289240c3542cc69a72204b6eb1edf76ce0302c9add2f70b679623e7187ca7211 | Julia | 1,647 | 46 | using Test
using CSV
using DataFrames
@testset "Transient Handling" begin
@testset "Observed Data Is Not Trimmed" begin
settings = ENEEGMA.create_default_settings()
raw_data = CSV.read(settings.data_settings.data_file, DataFrame)
settings.data_settings.psd.simulation_transient_sec = 2.0
... |
875ae1538ad73aa7189a6da022bbe90ae5d9f6881fb406985a7c1976ea3c7f12 | Julia | 1,734 | 61 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Reduced Wong-Wang model
# Brain source: synaptic gating variable S, matching the canonical ENEEGMA... |
1324bfe6834bc3edafe95bd4e28021b62c91c20a14fd9807f3a9d262212d3f51 | Julia | 1,764 | 55 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Wilson-Cowan excitatory/inhibitory neural mass
# Brain source: excitatory activity x11, matching t... |
10aeb9dbe37c81adf83bb259e84211164b17660ac38cb115ac23c5b76997f423 | Julia | 2,076 | 41 | # Example 1: Settings Configuration Walkthrough
# ============================================================================
# Demonstrates creating, inspecting, and saving ENEEGMA settings.
# Settings are stored as Settings objects with sensible defaults.
using ENEEGMA
using JSON
println("\nENEEGMA Settings Configu... |
b6f3c27061a1827c463c9c2fd7dddef1db7f93221652e227d6d8e50c519d8152 | Julia | 2,161 | 86 | using Clustering
using Statistics
"""
silhouette_from_D(D, labels) -> Vector{Float64}
Compute per-item silhouette scores from a square pairwise distance matrix.
Singleton clusters receive score 0 by convention.
"""
function silhouette_from_D(D::AbstractMatrix{<:Real},
labels::AbstractVe... |
4b801cd58a35f1cd0afc78a221e4a000fb12f6cd75f7bc9fde0d613b923017ab | Julia | 2,170 | 71 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Jansen-Rit cortical column
# Brain source: excitatory PSP minus inhibitory PSP (x21 - x31).
# ----... |
730d3550e1c76dbe06cbf789dea5518696c3212f12c29672f3dfa1e4c217d4bd | Julia | 2,530 | 87 | """
test_examples_subprocess.jl
Alternative test runner using subprocess execution for better isolation.
Each example runs in its own Julia process to avoid state pollution.
Usage:
julia --project test/test_examples_subprocess.jl
"""
using Test
# Test constants
const TEST_DIR = dirname(@__FILE__)
const PROJ... |
b439df8213fcb0885c58c692082a878627665b41667129d765c3af3f65d35094 | Julia | 2,712 | 70 | # Example 5: Hyperparameter Optimization
# ============================================================================
# This example demonstrates systematic hyperparameter optimization:
# 1. Load target data and configure neural network
# 2. Define hyperparameter sweep axes
# 3. Review all sweep combinations
# 4. Run... |
dbc89bec9d11e60010f609c8e3e96c29f8d2eacdd19f84e30325c27f4de7ea23 | Julia | 2,717 | 85 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# ARM (Lopes da Silva et al., 1974) — linear thalamic E↔I loop with α-synapses
# Pop E: thalamo-cort... |
191f7aa08e92abcc728e724ca8ce15ba354b170f5dba8758a7f536e39f224cad | Julia | 2,758 | 84 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Wendling neural mass model
# Brain source: excitatory PSP minus slow and fast inhibitory PSPs.
# -... |
cb8d4beb3362faba9d12cc8117fdfd6f959f9fa4ceaa6c667a1eb4fca73f5f82 | Julia | 2,785 | 97 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# ------------------------------------------------------------------
# Montbrió–Pazó–Roxin (2015) population model
# ẊR = Δ/π + 2 R V
# ẊV = V^2 + η₀ + I(t) - (π R)^2
# https:... |
df5c6dcbfc192c4668e9d8780da2eb392385314800782bbf0dfe5a8c86553603 | Julia | 2,942 | 81 | using Test
using ENEEGMA
using Random
function _canonical_test_network(model)
settings = ENEEGMA.create_default_settings()
settings.general_settings.path_out = mktempdir()
settings.general_settings.make_plots = false
settings.general_settings.save_model_formats = String[]
settings.general_settings.... |
8636d54de853e5dcfc122fd5ee193f9a37ac2b4abb9f1428067b1f84c39d6c5f | Julia | 3,003 | 67 | # Example 4: Parameter Optimization of Canonical Model
# ============================================================================
# This example demonstrates how to:
# 1. Load target data and prepare for optimization
# 2. Load candidate models from grammar sampling results
# 3. Select and build a network from one c... |
0089e6ec0da10d9946091747b7afe01f68bf95aa308bec2c7b6b06217e0606b1 | Julia | 3,177 | 61 | # Example 3: Grammar-Based Model Sampling
# ============================================================================
# Demonstrates how to sample neural network model structures from a probabilistic context-free grammar (PCFG).
# This uses the grammar defined in grammars/default_grammar.cfg to generate diverse mode... |
a71a6e72e00d2f9bea9a1876e35f2e91975d960e6df91044f4b7496601715088 | Julia | 3,333 | 101 | include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Robinson-Rennie-Wright corticothalamic model
# Brain source: excitatory pulse density Phi_e.
# ---... |
bd33fbaf55802c327910b42563ae87c2a947d1d23c9e33d097f3f5b623c77b60 | Julia | 3,469 | 77 | # Example 4b: Parameter Optimization of Sampled Model
# ============================================================================
# This example demonstrates how to:
# 1. Load target data and prepare for optimization
# 2. Load candidate models from grammar sampling results
# 3. Select and build a network from one ca... |
d95525643b48ff0590b6e9664c545a5ed670e03eacf3eb3e67a4536df41cfa66 | Julia | 3,537 | 111 | using StochasticDiffEq
include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Moran-David-Friston neural mass model
# Brain source: primary-population n... |
f38b870db8aecf20d04327786c0e37aaa0e94fc85eecc7405ee937b8d6c48ae6 | Julia | 3,570 | 117 | """
Optimization-related type definitions and structures.
"""
# ---------------------------------------------------------------------------
# Parameter Transform Types and Reparametrization Specifications
# ---------------------------------------------------------------------------
"""
ParamTransform
Abstract ba... |
0b2fe250d681c1e41e3e630ca376af7b22d65e1c37b8f160c0f31455ee06c551 | Julia | 3,652 | 84 | # Example 4c: Two-Node Network Optimization with Synthetic Data
# ============================================================================
# This example demonstrates how to:
# 1. Load 2-node network settings from JSON
# 2. Simulate the network with known parameters to generate synthetic data
# 3. Add measurement n... |
9ca90ba7e21b9dd95df688ab7a6dcf26be016e33a67f7afde5ae6fe99cba2d36 | Julia | 3,701 | 106 | """
Complexity measure utilities for ENMEEG model equations.
API
- compute_model_complexity(model; complexity_measures=["num_op", "num_rules"]) -> NamedTuple
Returns a NamedTuple with any of the keys: :num_ops, :tree_depth, :num_rules
"""
using SymbolicUtils
# Example: heuristic operator weights for a weighted ... |
c34a1093cbeab9d7a9036fec6fea6f7aa81ba1c54a0fe9914296f421b39085bb | Julia | 4,043 | 81 | using CSV
using DataFrames
@testset "Bound levels and adaptive expansion" begin
enabled = ENEEGMA.OptimizationSettings(Dict(
"optimization_settings" => Dict("adapt_parameter_bounds" => true),
))
disabled = ENEEGMA.OptimizationSettings(Dict("optimization_settings" => Dict()))
@test enabled.adapt... |
766468d8e99ab3c5747120f039b2411cb25cd083c8ac816108d7034d24aa8bd6 | Julia | 4,137 | 85 | # Example 2: Network Simulation
# ============================================================================
# This example demonstrates how to:
# 1. Set up a network
# 2. Build the network structure
# 3. Run simulations
# 4. Save and visualize results as DataFrame
# 5. Resample initial conditions or chang... |
bb5c315c3ede4dd75c80cbc4d5b31f9f720dc367916389c389e3addc23a9744e | Julia | 4,152 | 109 | using DataFrames
using DifferentialEquations
using Distributions
using Interpolations
using Plots
using Random
using Statistics
using ENEEGMA
function brain_source_dataframe(sol_df::DataFrame, source; source_name::Symbol=:brain_source)
brain_df = DataFrame(time=sol_df.time)
brain_df[!, source_name] = source is... |
8a6825af73d24b26e313c2d160480bb87ab515635960a6b5ff5ae5e6c23eef00 | Julia | 4,185 | 119 | ###############################################################################
# Larter–Breakspear (single column)
# https://github.com/the-virtual-brain/tvb-root/blob/master/tvb_library/tvb/simulator/models/larter_breakspear.py
# Brain source: membrane potential V, matching the canonical ENEEGMA node definition.
####... |
6bb3da37e594fc359db8c46fe9c96b0df9d4c76cdea30c0ab304119889ba0e7f | Julia | 4,434 | 139 | """
_parse_from(g, symbol, terminals, idx)
Internal helper for terminals2rules.
Tries to parse from nonterminal `symbol`, starting at `terminals[idx]`,
and returns either `nothing` or `(tree, new_idx)`.
"""
function _parse_from(g::Grammar,
symbol::AbstractString,
terminal... |
7afc538a5fbe8c97ff0209db751256ffc011742f885b9968baee603e4bd67177 | Julia | 4,808 | 108 | using StochasticDiffEq
include(isfile(joinpath(@__DIR__, "utils_plot.jl")) ? joinpath(@__DIR__, "utils_plot.jl") : joinpath(@__DIR__, "models", "utils_plot.jl"))
# -----------------------------------------------------------------------------
# Liley-Wright mean-field model
# Brain source: excitatory membrane potentia... |
0b72aeee8601388cce1757d990102c1657252a5cc40ecdff903201a6c517e159 | Julia | 4,870 | 74 | ####################################################################
########### Known Models Parse Trees ########
####################################################################
terminals_gsn = Dict(
"WC" => ["exp_kernel", "direct_readout", "custom", "custom", "false",
"e... |
8e1f3b7a50f909339c21f8c66c6f9e5ec544131f2fb8a7e531f212facd3edfcc | Julia | 5,530 | 121 | using Test
using ENEEGMA
using DifferentialEquations
function _delay_test_settings(tmpdir; delay=0.02, tunable=false)
settings = ENEEGMA.create_default_settings()
settings.general_settings.path_out = tmpdir
settings.general_settings.save_model_formats = String[]
settings.general_settings.make_plots = f... |
761595b3ce49668aa950e7769cb1febf139dd927169ff4101055035752e27823 | Julia | 5,888 | 210 |
###############################################################################
# Reduced Wong–Wang E–I (TVB-faithful) in Julia
#
# https://github.com/the-virtual-brain/tvb-root/blob/master/tvb_library/tvb/simulator/models/wong_wang.py
# Brain source: excitatory synaptic gating variable S_e.
#
# Goals:
# - Match TVB m... |
6c5e25122c87b4d6d2d4e0b122f7bd486608bd657e6ee37e09b128ab2ad4185b | Julia | 5,941 | 152 | using Test
using ENEEGMA
using DataFrames
const _G024_OUTPUT_RECIPE =
"2{7{9{12,12,17,20,21,22,20,58}},26,23,23,36}"
const _G159_OUTPUT_RECIPE =
"2{7{9{12,12,18,20,21,22,20,58}},26,23,24,36}"
function _grammar_brain_source_settings(model)
settings = ENEEGMA.create_default_settings()
settings.general_s... |
6f908c05fdc09b115f5af4f7f94e24ede622e20de10131a2d7a6aefa14ca2755 | Julia | 5,957 | 167 | #!/usr/bin/env julia
"""
Test loss function refactoring: explicit spectrum loss functions
"""
using ENEEGMA
sep = repeat("=", 80)
println(sep)
println("EXPLICIT SPECTRAL LOSS FUNCTION VALIDATION")
println(sep)
# Test 1: LossSettings has loss_function field
println("\nTest 1: LossSettings has loss_function field")
ls... |
0c9f6432bea38331d59b1bdc8f0c8638f0110ff29a4ed26fac8542af9a37752a | Julia | 6,033 | 145 | using Test
using ENEEGMA
function _coupling_test_settings(tmpdir::AbstractString, recipe::AbstractString, conn, conn_funcs)
settings = ENEEGMA.create_default_settings()
settings.general_settings.path_out = tmpdir
settings.general_settings.save_model_formats = String[]
settings.general_settings.make_plo... |
32ef36fbb47653ea211b7d2c6f2664a3bb4bd5b2d2fa3b63e13179125938aae2 | Julia | 6,057 | 136 | function get_output_dynamics(output_type::Symbol=:dict)
d = Dict(
"" => skip_output_dynamics,
"none" => skip_output_dynamics,
"direct_readout" => skip_output_dynamics,
"spatial_gradient" => spatial_gradient_dynamics,
"membrane_integrator" => membrane_integrator,
"diff... |
637bd81c39248f9b92475a686d9fbe8876628d503a1dc248ea894ed0c8b35dd8 | Julia | 6,206 | 154 | """
Data structures for managing loaded timeseries and precomputed spectral data.
"""
"""
NodeData
Per-node container for signal and spectral properties.
# Fields
- `channel::String`: Name of the data channel this node's signal came from
- `signal::Vector{Float64}`: Raw timeseries data for this node
- `freqs::Ve... |
0da175b24b5dea2394a97d9187e3de49c15aaf89de952faa5f0ee05ecbde1b92 | Julia | 6,329 | 160 | using Test
using ENEEGMA
@testset "Spectral ROI Settings" begin
@testset "Legacy Global Manual" begin
ds = ENEEGMA.DataSettings(
Dict(
"spectral_roi_definition_mode" => "manual",
"spectral_roi_manual" => [[7.5, 14.0]],
),
["C", "M"],
... |
c97d6bb1cc14933b00104ebee613050d0b1b2a0401af187571efc9e491b2ad0f | Julia | 6,618 | 167 | function build_population_dynamics(pop::Population, ss::SimulationSettings)
# Build each component of the dynamics
ENEEGMA.build_input_dynamics!(pop)
input_vars = [d.vars for d in pop.input_dynamics]
input_params = [d.params for d in pop.input_dynamics]
pop.vars = ENEEGMA.join_varsets([pop.vars... |
4ee8567dd1dfb00d0b6f1ef0257ca350da19bd1a2c6b3f13fd44ecec9555b05e | Julia | 6,947 | 222 | using Test
using ENEEGMA
using Symbolics
include("measurement_noise_bands_tests.jl")
include("mpr_tests.jl")
include("delay_tests.jl")
include("settings_serialization_tests.jl")
include("internode_coupling_fallback_tests.jl")
include("grammar_brain_source_tests.jl")
include("psd_preprocessing_tests.jl")
include("spect... |
64cae1ee25fa9a7754c420721d3a227fa4ef7eddb8254e233a418364c9f661fe | Julia | 7,506 | 229 | using Test
using ENEEGMA
function _gaussian_spectrum(freqs, center, sigma, amplitude)
return amplitude .* exp.(-0.5 .* ((freqs .- center) ./ sigma) .^ 2)
end
@testset "PSD Preprocessing" begin
settings = ENEEGMA.create_default_settings()
ds = settings.data_settings
ls = settings.optimization_settings.... |
ea5f729924514b49111795b2cd2babba26c7eeb4f4040c69af5ba56806ebca5d | Julia | 7,874 | 210 | function _brain_source_target_nodes(net::Network,
node_names::Union{Nothing, Vector{String}}=nothing)::Vector{String}
return [String(node.name) for node in net.nodes
if node_names === nothing || String(node.name) in node_names]
end
function _brain_source_output_key(t... |
c4deb56191f38b2c5536004695153a913dbb38ae5dfefab478e26f5091842887 | Julia | 8,235 | 219 | """
Hyperparameter sweep functionality for neural mass model optimization.
This module provides functions to systematically explore hyperparameter spaces for optimization,
including parameter range levels, reparameterization scales, optimizer settings, and more.
Usage: Import ENMEEG and call `run_hyperparameter_sweep... |
d26659bd0aeda46fe8beb46035bc75600735a0c58282fc3b95e2f256ad0e8010 | Julia | 8,275 | 266 | # Global verbose flag and helpers
const verbose = Ref(false)
const verbosity_level = Ref(0)
const _task_settings = Dict{Task, Any}()
function set_verbose(flag::Bool)
verbose[] = flag
verbosity_level[] = flag ? max(verbosity_level[], 1) : 0
end
function set_verbose(level::Int)
clamped = clamp(level, 0, 2)
... |
09ac0d0d973a21ee6b7fdb1d0763b534e87a87e5490b56ec01e9aae081d30f7f | Julia | 8,906 | 213 | """
ENEEGMA
A Julia package for grammar-based sampling, construction, and optimization of brain network models coupled to EEG data.
## Key Features
- **Grammar-based model sampling**: Generate diverse model structures from formal grammars
- **Network construction**: Build multi-node networks with flexible couplin... |
f3180aac500a14ec3f03016afae6feaaaa1d8bc992e7afb336d870ee65245f8a | Julia | 9,042 | 214 | # ============================================================================
# Save Simulation Results
# ============================================================================
# Saves simulation output (timeseries DataFrame, plots, and metadata) to a
# numbered simulation_N/ folder with organized figure/ subfo... |
a19b8fddb8b770afa638bfc4a82b6d4ab9bdc2656311fb1eac6820301b2b3450 | Julia | 10,061 | 217 | using Test
using ENEEGMA
using Statistics
function _phase_test_settings(tmpdir::AbstractString; loss_name::String="phase_velocity_gaussian")
settings = ENEEGMA.create_default_settings()
settings.general_settings.path_out = tmpdir
settings.general_settings.save_model_formats = String[]
settings.general_... |
ec53b9835ffdd5c4b277245cd2f60a1dda1dcbb578d28df8d748a434c7e3824b | Julia | 12,013 | 387 | """
Distance / dissimilarity utilities between sampled models and known models.
Two notions of equation distance:
1. Histogram / structural overlap via operation label histograms
2. Token sequence edit distance for canonicalized equations
api: calculate_distances_to_known_models(new_model, known_models; distance_typ... |
e0dadc4ae7d5f57c8d6d4552888ab4cd63a04baad6810665039440a34b685855 | Julia | 12,180 | 350 | """
Centralized evaluation utilities for model simulation and metric computation.
This module provides a single source of truth for:
- Simulating models with given parameters
- Extracting and processing predictions
- Computing PSDs
- Calculating metrics
This ensures consistency across optimization, evaluation, and an... |
3a613b2d74fd61db91aa63bea6569aaf04c8d7ae0420cce1d988989362034a58 | Julia | 13,641 | 394 | ###########################################################
## POPULATION STRUCTURE
############################################################
"""
This module defines the `Population` type, which represents a collection of neurons that have
a common dynamics within one node. They have a common way to receive input (s... |
bd74119409be7278742ceaee15c35aa7b35919a62d36036094ff04157fcdf375 | Julia | 13,745 | 334 | function get_conn_funcs(output_type::Symbol=:dict)
d = Dict(
"" => skip_conn,
"none" => skip_conn,
"false" => skip_conn,
"linear" => linear,
"standardized_linear" => standardized_linear,
"phase_input" => phase_input,
"piecewise_linear" => piecewise_linear,
... |
a2f4f25c57cb28b27dee497fadb2207f2c7cb84277b89ae543a2ddfcb74a0798 | Julia | 15,483 | 389 | """Utilities for diagnostics of phase-gradient-matching optimization results."""
function _phase_plot_indices(n::Int, max_points::Int)::Vector{Int}
n <= max_points && return collect(1:n)
stride = max(1, cld(n, max_points))
indices = collect(1:stride:n)
last(indices) == n || push!(indices, n)
return... |
16edb4fed7bd3712a999536cf0dfedb09dd86815ddedd1f6d88bc89bfc73af28 | Julia | 17,564 | 483 | # ---------------------------------------------------------------------------
# Pre-sampled model recipe loading
# ---------------------------------------------------------------------------
struct OptimizationResults
net_name::String
exp_name::String
task_type::String
data_path::Union{Nothing, String}... |
b1a203b2c02122b361d98485570a8bcf84c217aafec560a7db7b327542bec38b | Julia | 18,326 | 504 |
function string2num(name::String)::Num
# Convert to a proper symbol
sym = Symbol(name)
# Create a symbolic variable using @variables
ex = :(Symbolics.@variables $sym)
try
# Evaluate in the current module
Core.eval(@__MODULE__, ex)
# Return the variable
return Co... |
f5f6f2bade86440536fb92513b281bbd32db1a80fbb363ccff69284b77ee4516 | Julia | 18,641 | 439 | # ============================================================================
# Unified Visualization Functions for Simulation and Optimization
# ============================================================================
# Reusable plotting functions that work for both simulation-only and
# simulation+observation c... |
d10e2c0d4bdecca9fcdab1d29f1bc664048b188864bec3d5d305b66065a2360a | Julia | 20,292 | 553 | # ---------------------------------------------------------------------------
# Parameter reparametrization utilities
#
# Type definitions (ParamTransform, ParamReparamTransform) are defined in
# src/types/optimization_types.jl and exported there.
# ----------------------------------------------------------------------... |
db39ddf7ee9b8c700cce639867b6402117ce1d3985e6f5538ce09398cb3781a0 | Julia | 21,201 | 505 | """
simulate_network(net::Network;
new_params::Union{Nothing, NamedTuple, Dict}=nothing,
new_inits::Union{Nothing, Vector{Float64}}=nothing,
new_tspan::Union{Nothing, Tuple{Float64, Float64}}=nothing)::DataFrame
Run a single simulation for a network a... |
099f65df19ae78b6f2b105693cf2dcbfc599ac83f3d897b3b77cc2f0d0869f85 | Julia | 22,204 | 882 | # connectivity_motifs.jl
#
# Connectivity motif registries + helpers.
#
# Grammar tokens supported:
# Deterministic:
# 'null' | 'full' | 'chain' | 'ring' | 'star' | 'star_tail' | 'two_modules'
# | 'ei_block' | 'multi_cycle' | 'star_feedback_tail' | 'star_loop_extended'
# | 'ei_extended' | all c2_* (2×2 di... |
53f94db9487b1173a24834879a71541b014f7f47ebd06aa76d328afaabc991b0 | Julia | 23,315 | 686 | #############################
# variables.jl (refactored)
#############################
using SymbolicUtils
# You likely already have these utilities/types in your codebase:
# - string2num, string2symbolicfun, sort_symbols, vinfo
# - AbstractPopulation with fields: name, id, parent_node (which has name, id)
# -----... |
f2159987290f2d6d8fc346c92bd89ab1a533277b93958aeb101c7459e5a85b7f | Julia | 24,299 | 762 | # Minimal grammar utilities for:
# - loading a PCFG from a .cfg file
# - sampling derivations
# - working with rule trees
#
# This version does NOT build grammars programmatically.
# It assumes all rules and probabilities are defined in the .cfg file.
using Random
using OrderedCollections: OrderedDict
using Dist... |
af6d9686edd688bb8963ba2a13d3794a8ac95ccf47925a9de005b0cba04039fb | Julia | 24,604 | 709 | ###################
## PARAMETER BOUNDS POLICY LAYER
##
## Modular, composable bounds policy system with backward compatibility.
## Separates two concepts:
## 1. Bound policy: where bounds come from (scaled_defaults, table_by_type, named_table_level, unbounded)
## 2. Bound level: how permissive the bounds are (conserv... |
706d12e71394e7e5fd218bc59d8f0d2614b35350e894d84d797e105351f10987 | Julia | 26,677 | 642 | function build_nodes!(net::Network)::Network
netsett = net.settings.network_settings
simsett = net.settings.simulation_settings
sampsett = net.settings.sampling_settings
canonical_node_models = list_canonical_node_models()
nodes = Vector{ENEEGMA.Node}(undef, netsett.n_nodes)
# node_id, node_mod... |
c63a013f0ff009748d210a8e5dc7c29296bccf0253e92a16af1339150e0e68b8 | Julia | 27,251 | 673 |
# using Optimization, Dates
const OPTIMIZATION_PENALTY_LOSS = 1e9
const DYNAMIC_N_RESTARTS_MAX_BATCHES = 5
const ADAPTIVE_BOUND_MAX_EXPANSIONS = 2
const ADAPTIVE_BOUND_EDGE_FRACTION = 0.05
restart_rng(seed::Union{Nothing, Int}, irestart::Int) =
seed === nothing ? Random.default_rng() : MersenneTwister(seed + ire... |
a7f15a59562b2933c28e28a80157ab0fd5d6b8ee31ab3dd907f8bbb523515d2c | Julia | 33,968 | 884 | """
Data preparation utilities centralize timeseries loading, PSD computation,
and cached metadata used by optimization losses.
"""
using Statistics
# Data struct is defined in src/types/data.jl
function prepare_data!(settings::Settings)
eeg_data = load_data(settings.data_settings)
fs = settings.data_settings... |
2437079202ff8d58e23c5c99c0fd7cf4349714a4ab1a557518db9d1ed3d03d72 | Julia | 36,187 | 792 | function get_input_dynamics(output_type::Symbol=:dict)
d = Dict(
"none" => skip_input_dynamics,
"linear_kernel" => linear_kernel,
"phase_kernel" => phase_kernel,
"exp_kernel" => exp_kernel,
"gating_kinetics" => gating_kinetics,
"second_order_kernel" => second_order_ke... |
774e56f50f6e681077db331e7abc82f0276b87a14aa6ae1729a22570fb6724fc | Julia | 37,201 | 888 | function build_network(settings::Settings)::Network
check_settings(settings)
net = ENEEGMA.Network(settings);
ENEEGMA.build_nodes!(net);
ENEEGMA.construct_internode_conn_dynamics!(net);
ENEEGMA.construct_sensory_input_dynamics!(net);
ENEEGMA.construct_network_dynamics!(net... |
03bce22c8d2c74ed14d2768004e2a69e260fd2329d5ae0c4745f39d0df64237b | Julia | 39,485 | 1,112 | using FFTW
using DSP
"""
SpectralTransforms Module
Spectral analysis tools for power spectral density (PSD) computation with flexible
preprocessing pipelines. Designed for EEG and neural signal analysis.
## Main Methods
### Power Spectral Density (PSD)
- `compute_welch_psd()`: Single-signal Welch PSD estimatio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.