sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b8fba11d0c0456f8c0888a2382b79a926ad2e8bb7503eb191b56e16bd21a0b43 | Julia | 4,545 | 152 | using SBMLToolkit
using Catalyst, SBML, SBMLToolkitTestSuite
using Test
function readmodel(sbml)
return SBMLToolkit.readSBMLFromString(
sbml, doc -> begin
set_level_and_version(3, 2)(doc)
convert_promotelocals_expandfuns(doc)
end
)
end
COMP1 = SBML.Compartment(
"C",... |
5768ee12325a0a62f9df3bb55a5ab94d57d21f12f537c1695670a0f70d67a2c4 | Julia | 4,965 | 182 |
function makemarginalkdeplot(
chain_a,
chain_b,
visualizations_dir;
clip=((-3, 3), (-3, 3)),
scale_b=1,
saveas="",
subplot=1,
)
p1 = StatsPlots.marginalkde(
chain_a,
scale_b * chain_b,
linewidth=2,
grid=false,
clip=clip,#((-1.5, 3), (-3.5, 3))
... |
1446b7066dba8e914f42f2715d4486e89cd221f899c73d7707616d4104d5c487 | Julia | 5,011 | 151 |
using Glymphatics1D
sim = parseandanalyzePladataset(
(estimate_D=true, estimate_Dm=false, estimate_v=false),
);
sim = parseandanalyzePladataset(
(estimate_D=true, estimate_Dm=true, estimate_v=false),
);
sim = parseandanalyzePladataset(
(estimate_D=true, estimate_Dm=false, estimate_v=true),
);
@time par... |
7a0a4e7dfe91b597ff5205ce073a502927e4ac0a727c01c46c64b34b38b2cf4c | Julia | 5,112 | 192 | #################################################################
#Function and structures related to energy analysis
#################################################################
struct __tarifa
tc::Float64 # md" $t_c$: constant tariff"
tf::Float64 # md" $t_f$: off peak post tariff"
ti::Float64... |
ab40a64e793d237c0004540940cfadccafd31e2feb34d2c305b687a0eb9c403c | Julia | 5,694 | 171 | using OrdinaryDiffEq, PyPlot, Parameters
using BSON: @save
include("sim-functions.jl")
N = 2 # number of neurons
M = 50 # number of compartments per neuron
args_snic = MLMDS_Param(gL = 2.0, τδ = 2.5, Iext= 89.0, ρ = 0.8, M=M, λ=100.0)
args_hom = MLMDS_Param(gL = 2.0, τδ = 2.5, Iext= 131.79697, ρ = 1.4, M=M, λ=100.0)... |
a3aacf664dbd2ab13ca9558f7a2be03767085ff720c3dbe39fae88c07dd3a2fa | Julia | 5,885 | 173 | # Conversion to symbolics
const IV = default_t()
const D = default_time_deriv()
symbolicsRateOf(x) = D(x)
const symbolics_mapping = Dict(
SBML.default_function_mapping...,
"rateOf" => symbolicsRateOf
)
function interpret_as_num(x::SBML.Math, model::SBML.Model)
return SBML.interpret_math(
x;
... |
b5669f0ec59cdb6822ca611b54f286aad30f4f88c486d2f5c22f03cbae78e326 | Julia | 6,427 | 179 | #!/usr/bin/env julia
using ArgParse
using JSON
using Word2Vec
s = ArgParseSettings()
@add_arg_table s begin
"--vwify", "-v"
help = "convert JSON-GAM input to vw compatible format"
action = :store_true
"--importance", "-i"
help = "give errors a weight proportional to their mapping quality"
acti... |
93976d4f8a6bdd763c795bdec6593c680f9e41da5cb5283c2f008ec73ab027f5 | Julia | 6,466 | 180 | using SBMLToolkit
using Catalyst, SBML
using Test
cd(@__DIR__)
sbmlfile = joinpath("data", "reactionsystem_01.xml")
const IV = default_t()
@parameters k1, c1
@species s1(IV), s2(IV), s1s2(IV)
COMP1 = SBML.Compartment(
"c1", true, 3, 2.0, "nl", nothing, nothing, nothing, nothing,
SBML.CVTerm[]
)
SPECIES1 = SBM... |
6ad1017e88174006dddc8eb77e09c7a478d1ef8129333c502858c62b0f3e420c | Julia | 6,625 | 143 | include("fig-master.jl")
S_data = BSON.load("data/MLS-bif-general.bson")
gin_S = S_data[:gin]
Ibt_S = S_data[:Ibt]
gbt_S = S_data[:gbt]
Ih_S = S_data[:Ih]
Sh_S = S_data[:Sh]
DS_data = BSON.load("data/MLDS-bif-general.bson")
Isn = DS_data[:Isn]
gin_DS = DS_data[:gin]
Ic = DS_data[:Ic]
gc = DS_data[:gc]
Ibt_DS = DS_dat... |
15de64e889dc7a860e180cb63b71b06e94b34ef39ea9bb0890d8a347cee84f35 | Julia | 6,749 | 235 | """
Decompose time into tariff space (^f, ^i, ^p)
"""
function Decompose_Time(Δt::Time, s::Time, C::Time)
# define _finish time_
f = Time(s.instant + C.instant)
# time to its discreet values
sΔ = div(s.instant,Δt.instant)
fΔ = div(f.instant,Δt.instant)
CΔ = div(C.instant,Δt.instant)
# defi... |
564c1c82d4b5ea9626701366208528c914d19aca88a72f25e4626f20b23ed61c | Julia | 6,784 | 190 | using OrdinaryDiffEq, PyPlot, Parameters
using BSON: @save
include("sim-functions.jl")
N = 5 # number of neurons
M = 50 # number of compartments per neuron
args_snic = MLMDS_Param(gL = 2.0, τδ = 2.5, Iext= 89.0, ρ = 0.8, M=M, λ=100.0)
args_hom = MLMDS_Param(gL = 2.0, τδ = 2.5, Iext= 131.79697, ρ = 1.4, M=M, λ=100.0)... |
62c76a52de70723eff350003e9d8581eb4cc0c9437c0dc4b88830a1c71cbe516 | Julia | 7,047 | 212 |
function interpretparametersymbol(s::AbstractString)
s = replace(
s,
"alpha" => "α",
"tau" => "τ",
"mu" => "μ",
"Delta" => "Δ",
)
return Symbol(s)
end
function loadparams(paramsfile; kwargs...)
ks = keys(kwargs)
csvfilecontent = CSV.File(paramsfile)
par... |
601fbbe331db60c43dbf3c2b25f174298336c18f95073ec3a7d6f934674fbc6d | Julia | 7,606 | 215 | """
Convert SBML.Reaction to MTK.Reaction
"""
function get_reactions(model::SBML.Model)
subsdict = get_substitutions(model) # Todo: replace with SUBSDICT
rxs = Reaction[]
for reaction in values(model.reactions)
extensive_math = SBML.extensive_kinetic_math(model, reaction.kinetic_math)
symbo... |
c0f5edc6fbd08d5e301c70cc5e458dcc5508a79e4eda0854f9b013ef5109d849 | Julia | 7,824 | 231 | function parseandanalyzeGadobutrolinfusion(
fitting_parameters::NamedTuple;
n_samples::Int64=1000,
Turing_space_steps::Int64=15,
raw_datafile="data/inputs/gadobutrol intrastriatal/coronal_May21_TACs.csv",
gadobutrol_parenchyma_measurement_locations="data/inputs/gadobutrol intrastriatal/coronal horiz... |
82b26c8afa49c8508cf260750dfd42b8d2469989937099294c7bd39cd166e321 | Julia | 7,850 | 248 |
function makeODEProblem(
simulation::GlymphaticSimulation,
parameters,
)#::Tuple{ODEProblem, NamedTuple}
timedifferential! = simulation.encloser(parameters)
#@unpack D, Dm, v, T_max = parameters
#p = [D, Dm, v]
#p = ComponentArray(D=D, Dm=Dm, v=v)
p = ComponentArray{Union{Bool,Int64,String... |
27cc963746162c8df0795c04ee1d868d78084be9d408aae6fc7d085cd8504611 | Julia | 7,889 | 255 |
function load_data!(simulation::GlymphaticSimulation, source_file::String)
simulation.data = DataFrame(CSV.File(source_file))
return simulation.data
end
function parse_Lee_data(source_file::String, parsed_datafile::String)
rawdf = DataFrame(CSV.File(source_file))
GdDOTA_g_per_mol = 558.65
GdDOTA... |
ea06ec23145a60da1cb64eff6c315c089309bb6ed884fcc8feed1f82383bf3a6 | Julia | 8,066 | 83 | using Plots, Plots.PlotMeasures
using LaTeXStrings
pyplot()
savedir = "visualizations/"
# Exported from maple
cg = (Pe,phi__1,phi__3) -> (-16 * Pe * phi__1 * phi__3 + 16 * exp(Pe) * Pe * phi__1 * phi__3 + 4 * exp(Pe) * Pe ^ 2 * phi__3 ^ 2 + 16 * exp(Pe) * phi__1 * phi__3 ^ 2 + 4 * exp(Pe) * Pe ^ 3 * phi__3 - 4 * Pe ^ ... |
fe161cdea8e378f98cfe3fa182eba9582f07e874f9fdb27236afed0c4ab242ad | Julia | 8,991 | 276 |
abstract type GlymphaticModel end
mutable struct GlymphaticSimulation <: GlymphaticModel
prior_parameters::NamedTuple
initial_condition::Vector{Float64}
encloser::Function
fitting_parameters::Union{NamedTuple, Nothing}
turingmodelgenerator::Function
prior_predictions_df::Union{DataFrame, Nothi... |
2d8f3a14936d806d3e1641585372634ed18ad992fab49d3e6cfcb17df4c01b42 | Julia | 9,102 | 309 | include("activation.jl")
using Statistics, DiffEqCallbacks, Setfield, Parameters
function neuron_sim!(du, u, p, t)
du .= Fall_dyn(u,p)
nothing
end
function network_sim(du, u, p, t)
@unpack M, dims = p[1]
N = length(p)
D = M+dims # number of dimensions in each cell
for j=1:N
du[D*(j-1)+1:D*j] .= Fall_d... |
f56e01667d2a872946d654d43e8fe357b7d6819817e62eb61376114426c38c9a | Julia | 9,286 | 239 | module SHC
# Add julia packages here
using BenchmarkTools
using BSON
using Colors, ColorSchemes
using DataFrames
using Dates
using GeometryBasics
using GLMakie
using LaTeXStrings
using Plots
#using StatsKit -- to heavy to keep included
using Statistics
using Distribu... |
259a530312c9c6d44bb875a05d4c3666927ce716ff252d687cecaee91fb2b72b | Julia | 9,821 | 294 | using SBMLToolkit
using Catalyst, ModelingToolkit, SBML
using OrdinaryDiffEq
import Symbolics
using Test
cd(@__DIR__)
sbmlfile = joinpath("data", "reactionsystem_01.xml")
const IV = default_t()
@parameters k1, c1
@species s1(IV), s2(IV), s1s2(IV)
COMP1 = SBML.Compartment(
"c1", true, 3, 2.0, "nl", nothing, nothin... |
add8d75a038bfbdd4863bb71b3c2f7114233e2fbe609eb0b68fb0fd0684201c0 | Julia | 10,731 | 347 | #################################################################
#Auxiliary Functions
#################################################################
"""
Generate time based horizontal axis with time spam of hora
"""
function time_xaxis(hora::Int64)
DateTick=Time(0):Hour(hora):Time(23,59,59)
DateTickFo... |
2ca7cdcb8b80f89fdf4d95d16a0068105858d782db880245288baa17f68deb3d | Julia | 11,805 | 363 | function parseandanalyzeCserrdataset(
fitting_parameters::NamedTuple;
n_samples::Int64=1000,
Turing_space_steps::Int64=15,
turingmodelgenerator=posteriorsamplergeneratorCserr,
raw_datafile="data/inputs/scraped_data.csv",
parsed_datafile="data/parsed/Cserr_parsed.csv",
savedir_results="data/r... |
ee5b5fd3755e936082f1bbae3b7df6d58cc26d64d982ab253e910605e6981292 | Julia | 12,240 | 411 | """
DefaultImporter()
Select SBMLToolkit's default normalization pipeline for `SBML.readSBML`.
The pipeline checks for unsupported features, upgrades the document to SBML Level 3
Version 2, and promotes local parameters and function definitions.
# Examples
```julia
model = readSBML("model.xml", DefaultImporter(... |
76f113c625d4784c22e3130d68633f5cf60b7e3b3aa2cb54dc6fdc67258525da | Julia | 13,072 | 373 |
"""
enclosethetimedifferential(fixedparameters)
Provides the closed derivative function, which knows all the
fixed parameters but takes the D, Dm and v parameters in its p argument.
"""
function enclosethetimedifferential(fixedparameters::NamedTuple)::Function
@unpack (r_space, Δr, Δ, ∇) = fixedparameters
... |
82be7cd27dba976940a9e0bccea4f6d0c7cb1f5b3dbc3c667c2a7c01d3a44e1d | Julia | 14,095 | 447 | using Glymphatics1D
using DataFrames, CSV
using Statistics, Distributions
using Plots
using MCMCChains#, Turing
using Plots, Plots.PlotMeasures
using LaTeXStrings
using Serialization
fitting_parameters=(estimate_D=true, estimate_Dm=true, estimate_v=true)
paramcombinationstring = makeparamcombinationstring(fitting_para... |
228f27445637bcf940b0fbe4d121d419ad42fc0ea5b03384222225439cc55336 | Julia | 16,906 | 570 |
function plot_ode_solution_mass_distribution(
simulation::GlymphaticSimulation,
ylabel::String;
savefile::String="tmp_brain_mass_model.svg",
savedir::String="../Visualizations/",
legendloc::Symbol=:right,
)
t = simulation.ode_solution.t
(bm, m_v, m_csf, m_b) = state_mass_over_time(
... |
ce35a10f8da3514f755cc670dba34d4e388bca2541f15264074a884eedac173c | Julia | 18,975 | 576 | # Import packages
using OrdinaryDiffEq, DataDrivenDiffEq, SciMLSensitivity
using Optimization, OptimizationOptimisers, OptimizationOptimJL
using LinearAlgebra, Statistics
using ComponentArrays, Lux, Zygote, Plots, StableRNGs
using Optim
using Measures
gr()
using PlotlySave
using BenchmarkTools
rng = StableRNG... |
e55e0075a4cbd2ad4923e8830df65de471a64152791e93301a9af4845b0c8b63 | Julia | 30,253 | 583 | # 10 random LOADS
GEOFINDER – B[1]
Mean Comfort = 0.976386362928405, Mean NormCost = 0.8714381522761603
BenchmarkTools.Trial: 100 samples with 9 evaluations.
Range (min … max): 2.433 μs … 11.889 μs ┊ GC (min … max): 0.00% … 0.00%
Time (median): 2.511 μs ┊ GC (median): 0.00%
Time (mean ± σ):... |
a2cc5b47fb43d07bc4cb5a0f1edb16f66d77607e3a55bef4a9605293ee70ecfb | Jupyter | 29 | 2 | # %% [markdown]
# # Tutorial
|
21c9f358642e3c6cb0aba911fbb3229f4252be7af452a196c1625513c9315e2a | Jupyter | 60 | 5 | # %% [markdown]
# # References
#
# ```{bibliography}
# ```
|
308f3dc69588f04f507870756af6c7a83168018752c19e6481a0e31ef1bc0d2e | Jupyter | 130 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:476cb7ce78fb2b638e8cdca9cd884f9a553d0c96347568019bdd491fb8ed5d40
size 75469
|
35ea2089627fa18af017ac3920a52afa4493ed46a686a6ec26ec79f72c0faba6 | Jupyter | 130 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:e45802602d327df27b252bbc1db9accbb86d6d09fded8a7c13905017f014d7e0
size 37021
|
6ad6083f4d0b3eeefc4c0eaf39027b4ffc46229c33d49a588c101e81bd12143c | Jupyter | 130 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:81ef08dcfb10201f9cee82b837c647d60227e4ee57e076d8c0760479ef4c98cb
size 16845
|
b66dee042e3c35a859b6090c16912eb8ab717cece8b6b9e65e0f2bc7aea3bf87 | Jupyter | 130 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:9c5f5a372c54b6eb27951b2d32eb986731c5527e8b75918f914dc8e03e33be37
size 36268
|
c95a58cb18169754b9a14f51d170d8a798df53ea7970d3104923f8616d7d9db5 | Jupyter | 130 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:c0ecee7ec09052a3d9034fa432fd6dc65b593fc473f3eea17d26743ca826cb2c
size 25288
|
d01f2debb00b5efa8dc46a8d204fcfc8a0f4b792ce5462014bebed9a24be9ecd | Jupyter | 130 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:5d16de2b2c4495a3dc947549548dc102f2f8d6ee8f80b2171dcbd5391f7253f5
size 63636
|
dd9efc13baeb44dd8ad8b265f92bda7b203f69c2abeff6b34b0b74b9eef80cf8 | Jupyter | 130 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:3b3cd4bd4038e5b586eafff8dd9e5cbf85f0c041640da920054786c03937f1f1
size 39513
|
1bfcef70bfd5580e5d443e707ffce37ccd167bdaa356384c611002a42468639f | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:3096af1a3c119e0b4c295628caa247c7a562a6ccd482ea09eeecd02926dcecdc
size 977040
|
2c53a804290d266302f6080823b5b2f9ffd123e390575d7593c377498ee68253 | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:ef62b0e4a4e97cc5b8a3219774625b87f02b2f40e340fd5049131f789819fff5
size 202977
|
408f8fc7d724a39bceb0de12e5eba73822e3d6a26a511b64d8377d90fdb04726 | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:8500b1c48081cad77af343f9b4f19a38a0d71eb7ea70862bfbb5c5a9f6adadba
size 227671
|
496ba4609ad4dde981495be1cc7cb7a7a25b7337b6e35939e28d43f60a3d329f | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:86fb24372e3ca9350f7a8fb9b2a3dd7035491e0dcaaa1a5d0b76a86abb11a970
size 345584
|
6c5c717a6ed5d7037631eade5b6353be5b4297e9006aa049aab1945accc317e5 | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:5f7dbf53fbd11034788b09f1eea16e7067d198a3352d86bd21ad48e92dc99b9a
size 128907
|
8ccde4cb9ef9d252e2ae72237ee740258137c90fd18e9bc743c2fa7bba21186f | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:6a378bab2df2327b2cc309ff2dc265b9fa9762dc34d10196ad284ebc38675583
size 123474
|
9a922026b4c6ec72755dac844d2ae71d205990de644dd6c858946b7a335763d7 | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:fffe3178183d76aacc35cf98e5ecc574c7b038f440583af28c6c0228e7669987
size 489972
|
ba1242af13a27247a76eb5fa09d9cecaef603ea50c1d56c4576c69e35209b6f8 | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:b792a52e4ae1751b4881d879c81fdc8a8c27046d437aac96b7f4acbb5da428e2
size 278436
|
ced8ae0b24429e81e9377523bdbaada1cf6389e7dfcf8bb43c16f782c96358dd | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:a8061c32ff1dcd5b168e923531d982c2652fd51a72d2af3563c6cee2cbeb312c
size 578088
|
cfaabea08eac6f0a77ec5968d791df92164e9e8581d5f10019344057fbab709d | Jupyter | 131 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:9863d952c6375751e4369e71a7b024b52acdd2f079222d2676f557ad5b0b0b66
size 915947
|
ffcb5877298802b3ac056b4e3e500fe9158718a2f7f00f5649f81925ae2de928 | Jupyter | 132 | 3 | version https://git-lfs.github.com/spec/v1
oid sha256:363435d01c8dc0d38b45f32df2726c6e1abdcc008e478bfb448a8630f8deb042
size 1035618
|
9ce04a1ed0b4d71cfe84177123aa68cb823ccbd74490d12758f275abda7bf637 | Jupyter | 139 | 4 | # %% [markdown]
# # WIP
# - Docs preparation is on going!
# - We will publish our online documentations when our manuscripts are accepted!
|
36742878b76d7341c1ec6e029686df999c351ede66e7feddc31d6227979acbb4 | Jupyter | 330 | 9 | # %% [markdown]
# # Train your own ensemble network
#
# For training your own ensemble network you need
#
# 1. To define your training data (i.e. spycon tests)
# 2. Define your base methods.
#
# Then you can use the training methods provided in `coninf/sci_ensemble.py`. An example script is provided in the `/script/... |
a8d9180f9ae43c9d8d515cf006e38c059d8a5ddb4f84a0883079118cc0a0559f | Jupyter | 333 | 18 | # %%
from pathlib import Path
import sys
from dotenv import load_dotenv, find_dotenv
load_dotenv()
PROJECT_ROOT = Path(find_dotenv()).parent
sys.path.append(str(PROJECT_ROOT.joinpath('src')))
from utils.ROI_plots import plot_all_syn
from utils import olc_client
c = olc_client.connect(verbose=True)
# %%
plot_all_... |
bbcfc3b31d0ce6b8db6b012025a66c73de74b6e3936093b62a70a9c6714368b3 | Jupyter | 348 | 19 | # %%
from pathlib import Path
import sys
from dotenv import load_dotenv, find_dotenv
load_dotenv()
PROJECT_ROOT = Path(find_dotenv()).parent
sys.path.append(str(PROJECT_ROOT.joinpath('src')))
from utils.ROI_plots import plot_pin_assignment
# %%
from utils import olc_client
c = olc_client.connect(verbose=True)
# %%
p... |
b8d68518f5459cfc1fed53bd800ff6183055bf15b995194c724c69fe06e29369 | Jupyter | 351 | 18 | # %%
from pathlib import Path
import sys
from dotenv import load_dotenv, find_dotenv
load_dotenv()
PROJECT_ROOT = Path(find_dotenv()).parent
sys.path.append(str(PROJECT_ROOT.joinpath('src')))
from utils.ROI_plots import plot_mi1_t4_alignment
from utils import olc_client
c = olc_client.connect(verbose=True)
# %%
... |
4524d9eaf56054f35f6ba7075555d293464b9772b09d4eb0ecc2b8dd9f326748 | Jupyter | 395 | 20 | # %%
import pandas as pd
import numpy as np
# %%
species = 'ecoli'
kind = 'test'
dataset_name = f'{species}_{kind}_sub.tsv'
# %%
df = pd.read_csv(dataset_name, header=None, sep='\t')
df.columns = ['p1', 'p2', 'label']
df
# %%
list_unique_id = list( set(list(df['p1'].values)+list(df['p2'])) )
pd.DataFrame(list_uniqu... |
dec0e88662f0322652f08925a272ec6af40b34da1d4ebd11b4accf1391df7dff | Jupyter | 397 | 15 | # %%
from tools import Artist, EDA, SuematsuData, metapipeline
from tools import StratifiedGOAnalysis as SGOA
from tools import eda_longitudinal_args as ela
from tools import sgoa_longitudinal_args as sla
# %%
data = SuematsuData()
metapipeline([
Artist(),
EDA(data, adgile=True),
EDA(data, args=ela, adgi... |
a7f0a5982fa5f44ad7a3f399152883ba490fa6d18e27ef389ce13b1b8b05e504 | Jupyter | 415 | 18 | # %%
from pathlib import Path
import sys
from dotenv import load_dotenv, find_dotenv
load_dotenv()
PROJECT_ROOT = Path(find_dotenv()).parent
sys.path.append(str(PROJECT_ROOT.joinpath('src')))
print(f"Project root directory: {PROJECT_ROOT}")
from utils import olc_client
c = olc_client.connect(verbose=True)
# %%
from ut... |
91baa60afc9a576dd5cec5fd370b1f57670d84dbe9e210337c87100b5a88a0e9 | Jupyter | 458 | 22 | # %%
import pandas as pd
import numpy as np
# %%
species='ecoli'
kind = 'test'
dataset_name = f'{species}_{kind}.tsv'
subset_size = 6000
# %%
df = pd.read_csv(dataset_name, header=None, sep='\t')
df.columns = ['p1', 'p1', 'label']
df
# %%
df_shuffled = df.sample(frac=1, random_state=42).reset_index(drop=True)
df_sub... |
aa26bf02a1347a317509542b88b3c730dccc3732e0da4f0cdd4ac9c14c17c83a | Jupyter | 473 | 23 | # %%
%load_ext autoreload
from pathlib import Path
import sys
from dotenv import load_dotenv, find_dotenv
load_dotenv()
PROJECT_ROOT = Path(find_dotenv()).parent
sys.path.append(str(PROJECT_ROOT.joinpath('src')))
from utils import olc_client
c = olc_client.connect(verbose=True)
# %%
%autoreload 2
from utils.ROI_voxel... |
b412ed50660b0b74b65826389757ad6d0cd91799b00defc703bd9fda9a383474 | Jupyter | 538 | 43 | # %% [markdown]
# Imports:
# %%
from samalg import SAM
from samalg.gui import SAMGUI #this is the interactive GUI
# %% [markdown]
# Initialize SAM
# %%
sam=SAM()
# %% [markdown]
# Load data from a file
# %%
sam.load_data('../example_data/schisto2.5_tpm.csv.gz')
# %% [markdown]
# Preprocess the data
# %%
sam.prep... |
d91aa063177f9d95f322e3b276c238b321460a5b632ddba0202deadc110e2974 | Jupyter | 553 | 22 | # %%
# Step 3: GRU Model
def build_model(total_words, max_sequence_length):
model = Sequential()
model.add(Embedding(total_words, 50, input_length=max_sequence_length - 1))
model.add(GRU(100, return_sequences=True))
model.add(GRU(100))
model.add(Dense(total_words, activation="softmax"))
model.c... |
201cac4dd728034e66ea5914fffee2447e8537dc2a9af9d3cd2b1b0ddea5461f | Jupyter | 561 | 27 | # %%
! pip -q install flaml
# %%
# Please Upload CSV file.
# %%
! git clone https://github.com/benzenedog/Regression-of-mPAP-of-CTEPH.git
! cp Regression-of-mPAP-of-CTEPH/regression_train_test.py regression_train_test6.py
# %%
! date +"%Y/%m/%d %H:%M:%S" > st.txt
! python regression_train_test6.py --dataset 1 --sc... |
d89c6ab02f7d1f8830645ef145d29a387d6a2c00ef80f533e46588fd1c2f39d5 | Jupyter | 563 | 27 | # %%
import pandas as pd
import numpy as np
# %%
species = 'ecoli'
kind = 'test'
dataset_name = f'list_{species}_{kind}.txt'
# %%
dict_species = pd.read_csv(f'{species}_dict.tsv', header=None, sep='\t')
dict_species.columns = ['id', 'seq']
dict_species = {key: value for key, value in zip(dict_species['id'].values, di... |
74883a109980dda6ca78dd92f4c9b265fc84aefebb6c481832c611a1ba250a00 | Jupyter | 567 | 36 | # %%
import pathlib
import meniscus_rate2
from loess import loess_1d
import real_unit_convert as ruc
import numpy as np
import pandas
from matplotlib import pyplot
import statistics
# %%
from examine_relationship import list_filenames
# %%
m_names, p_names = list_filenames()
# %%
uc = ruc.UnitConversion()
# %%
m_t... |
96ecb4bdbe34f2f4adae4703875d9daf6d64cf4ff9054411b830b2fd0fd8ebf0 | Jupyter | 569 | 27 | # %%
import pandas as pd
import numpy as np
# %%
df = pd.read_csv("AAidx.txt", sep='\t')
list_amino_acids = df.columns[1:]
total = 0
number = 0
for aa in df.columns[1:-1]:
total += df[aa]
number += 1
df['X'] = round(total / number, 2)
df['J'] = round((df['I'] + df['L']) / 2, 2)
df['Z'] = round((df['E'] + df['... |
298fe938c2e7e3c43dc9ce78ced2668c9b402c03ef6a28ef494cc75d3d53f4cb | Jupyter | 598 | 29 | # %%
import qbiome.network as qbnet
networkfile='tmp.png'
# %%
network=qbnet.Network('./hypothesis_phylum_31_33_-1.dot',outfile=networkfile)
# %%
network.get()
# %%
from IPython.display import Image
from IPython.core.display import HTML
Image(filename=networkfile)
# %%
network2=qbnet.Network('./hypothesis_phylum_3... |
fc37ad7eb0eaed1f6259885756e1ee7e5e11a03ea2b958560dc8617defe2a9f4 | Jupyter | 610 | 26 | # %%
! pip -q install deap update_checker tqdm stopit
! pip -q install -U xgboost tpot
# %%
# Please Upload CSV file.
# %%
! git clone https://github.com/benzenedog/Regression-of-mPAP-of-CTEPH.git
! cp Regression-of-mPAP-of-CTEPH/regression_train_test.py regression_train_test6.py
# %%
! date +"%Y/%m/%d %H:%M:%S" >... |
3982fff658d168bea5b8b289863c13a92763867e21d5bb2eb240f23e3b21dfee | Jupyter | 628 | 33 | # %%
from IPython.display import Image
# qbiome imports
import qbiome
from qbiome.hypothesis import Hypothesis
from qbiome.quantizer import Quantizer
# %%
quantizer = Quantizer()
quantizer.load_quantizer_states('quantizer.pkl')
# %%
hypothesis = Hypothesis(quantizer=quantizer, model_path='./dotfiles',
... |
72c3bb1276977ffb960ff1eea0b74bd0992625c87bc68158da470b2bbeff47d2 | Jupyter | 643 | 31 | # %% [markdown]
# # regression models constructed with manual tuning
# %%
! pip list | grep learn
# %%
#! pip install scikit-learn==0.23.2
# %%
# Please Upload CSV file.
# %%
import pandas as pd
df = pd.read_csv("2021_1218_main_NA_excluded.csv")
df.head()
# %%
! git clone https://github.com/benzenedog/Regression... |
b83c93b1f6722b38b114f153b1155167b99863b01151242e2718ecd83a243975 | Jupyter | 644 | 30 | # %%
import vrpn
import socket
import time
# 建立与MATLAB的连接
host = 'localhost'
port = ******
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
# VRPN回调函数
def vrpn_callback(userdata, data):
print(f"Received: D:\openvibe file\signal")
# 发送数据到MATLAB
s.sendall(str(data.position).enco... |
86e4e0c06f45762bd452b1053a28467badfbe7d7481d1f19115705c1505f290b | Jupyter | 657 | 35 | # %%
import os
import sys
sys.path.insert(0, os.path.abspath('../../qbiome'))
from IPython.display import Image
from hypothesis import Hypothesis
from quantizer import Quantizer
# %%
quantizer = Quantizer()
quantizer.load_quantizer_states('quantizer.pkl')
# %%
hypothesis = Hypothesis(quantizer=quantizer, model_path... |
23e1da79bbe0d9bb401bb3d85bf90628b9812c9d67102d294c2b6b00248016d4 | Jupyter | 694 | 24 | # %%
# This tutorial is to preprocess a dicom file of DXR acquired images, and run SLEAP-based tracking
# Imports
import os, matplotlib, pandas as pd, numpy as np, pickle as pckl, skimage, sys, shutil, time, scipy, pywt, cv2, datetime, subprocess as sp
import matplotlib.pyplot as plt, seaborn as sns, json, matplotlib... |
d82cec5473133ed50d2bc1e81ad1305fbbd3e4e81d00da6d0f5cc05a9f14bd7f | Jupyter | 694 | 26 | # %%
from tensorflow.keras.layers import Dense, Embedding, SimpleRNN
from tensorflow.keras.models import Sequential
# Step 3: SimpleRNN Model
def build_model(total_words, max_sequence_length):
model = Sequential()
model.add(Embedding(total_words, 50, input_length=max_sequence_length - 1))
model.add(Simple... |
3f812a9df5d95314a99ec2b38860b2250db190619acdbef5925001b44fe33bc1 | Jupyter | 710 | 24 | # %%
import pandas as pd
import numpy as np
from sklearn.model_selection import StratifiedKFold
# %%
df = pd.read_csv('hp_pairs.tsv', sep='\t', header=None)
df.columns = ['p1', 'p2', 'label']
df = df.sample(frac=1).reset_index(drop=True)
df
# %%
skf = StratifiedKFold(n_splits=5, random_state=42, shuffle=True)
train_t... |
c14eb7673b865bcccd634064b037a28a9945dba1568fa2a85a0ae6eadc8f4529 | Jupyter | 722 | 27 | # %%
from pathlib import Path
import sys
from dotenv import load_dotenv, find_dotenv
load_dotenv()
PROJECT_ROOT = Path(find_dotenv()).parent
sys.path.append(str(PROJECT_ROOT.joinpath('src')))
from utils.ROI_calculus import create_ol_layer_boundaries
from utils import olc_client
c = olc_client.connect(verbose=True... |
d72beec395498e99a29822aa5d675fa8fbf22313182be5cc37ec8d5307d792b8 | Jupyter | 737 | 35 | # %%
%load_ext autoreload
%autoreload 2
import lzma
import dill
import json
import pandas as pd
import shap
from tqdm.auto import tqdm
import numpy as np
import tensorflow as tf
from pathlib import Path
import scienceplots
import matplotlib.pyplot as plt
import matplotlib as mpl
from matal import load_model, load_d... |
75b32c3f532dcdd0265030cdc4434f7fc8b311d0dd87bc7a52ade8d7a18dcc69 | Jupyter | 757 | 27 | # %%
# Function to calculate sequence similarity
def calculate_similarity(sequence1, sequence2):
alignments = pairwise2.align.globalxx(
str(sequence1), str(sequence2), one_alignment_only=True
)
best_alignment = alignments[0]
alignment_score = best_alignment.score
similarity = alignment_score... |
c5dfe2be9936fc50d2561c610709b58dda5d6ad0b35ecaedc45203287890cc61 | Jupyter | 770 | 46 | # %%
import os
import glob
import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.manifold import TSNE
from umap import UMAP
import seaborn as sns
sys.path.append('../')
import src.utils as my_u
from src.utils import df_cp
from src.utils import df_log
from src.utils import df_t... |
89b28757b4e893b00d4d7a4f46d356e95582c64a46aa337f46e428f0be7f5312 | Jupyter | 783 | 35 | import tifffile
image = tifffile.imread(r"G:\raw data\demo\image.tif")
mask = tifffile.imread(r"G:\raw data\demo\mask.tif")
print(image.shape)
print(mask.shape)
import matplotlib.pyplot as plt
plt.imshow(image[0], cmap='gray')
plt.axis('off')
plt.imshow(mask[0], cmap='gray')
plt.axis('off')
import numpy as np... |
ee3e7fe9e8417923cbf526a4ad55513706558a474f90d92e510dac6782cbe234 | Jupyter | 797 | 28 | # %%
"""
This cell does the initial project setup.
If you start a new script or notebook, make sure to copy & paste this part.
A script with this code uses the location of the `.env` file as the anchor for
the whole project (= PROJECT_ROOT). Afterwards, code inside the `src` directory
are available for import.
"""
imp... |
1a842e10546eb52a5e15ca3f32080780f135850cf6c2f5fbfe2f20581baffbac | Jupyter | 820 | 38 | # %%
# default_exp core
# %%
!which python
# %% [markdown]
# # Core (deprecated)
#
# > Adapt the simpletransformer ClassificationModel to use a SmilesTokenizer (deprecated). The models can now direclty be imported from the `rxnfp` package
# %%
#export
import os
import numpy as np
import torch
import random
import p... |
ba428653eb3f8c4d49a36a4a3e316d4d85ccd13ee383323d7bc414b3625b8e1a | Jupyter | 833 | 43 | # %%
from IPython.display import Image
# qbiome imports
import qbiome
from qbiome.data_formatter import DataFormatter
from qbiome.quantizer import Quantizer
from qbiome.qnet_orchestrator import QnetOrchestrator
# %%
# the directory to save the dotfiles to
outdirname = 'dotfiles'
# %% [markdown]
# # Load exisiting qu... |
69f6b1f5063ee342fb616b37dd0451ab80f218fa10247c6a40cc4bcdb89ef1a6 | Jupyter | 855 | 45 | # %%
import os
import sys
sys.path.insert(0, os.path.abspath('../../qbiome'))
from IPython.display import Image
from data_formatter import DataFormatter
from quantizer import Quantizer
from qnet_orchestrator import QnetOrchestrator
# %%
# the directory to save the dotfiles to
outdirname = 'dotfiles'
# %% [markdown]... |
da7144d2ebdc1134f1de23c22f19e5acdacf27e01eb196888bdd6bbd95c4a7d1 | Jupyter | 894 | 48 | # %%
! pip -q install autokeras
# %%
# Please Upload CSV file.
# %%
! git clone https://github.com/benzenedog/Regression-of-mPAP-of-CTEPH.git
! cp Regression-of-mPAP-of-CTEPH/regression_train_test.py regression_train_test6.py
# %%
%%bash
mkdir -p log/
date +"%Y/%m/%d %H:%M:%S" > st.txt
for i in `seq 0 9`
do
cm... |
a4eace403f40d2aabd4676ba9ad730e35592e9f1b2bb864af72f923d850ff44c | Jupyter | 903 | 32 | # %%
import tdt
import glob
import os
import pathlib
import re
from med_associates_utils import SessionCollection, Session, parse_tdt_directory
from med_associates_utils.viz import plot_cumulative_events, plot_event_raster
# %%
sessions = parse_tdt_directory(r'M:\2024 July,Aug GRABDA2m data (DLS C1906Y)/misc/RI30-24... |
641229c7f9fedd9d4fdbc15aa0e79ae8073508fed5b9927b0681cb9abbe37ad8 | Jupyter | 923 | 55 | # %%
#install.packages("psych")
library(psych)
# %%
method1_res <- read.csv("method1_res.csv", row.names="X")
method2_res <- read.csv("method2_res.csv", row.names="X")
# %%
head(method1_res)
# %%
head(method2_res)
# %%
correlation_res <- apply(method1_res, 2, function(x){
apply(method2_res, 2, function(y){
... |
110b863f8376176049bea76c1e3a80856bd402b1b9564f9f6ece929495439162 | Jupyter | 938 | 51 | # %% [markdown]
# # `SuematsuData` class
# - class for loading preprocessed RNA-seq data (for more details about raw data preprocessing, refer to [this page](https://colab.research.google.com/drive/1ubDJfJuaEdBgRhwst_UkIeU1bJurIl24?usp=drive_link))
# %%
from tools import SuematsuData
# %% [markdown]
# ## Usage
# 1. r... |
c0d9077173703957511013f9d69672fb2d84de42ef85a8458ceb5d35030e6353 | Jupyter | 938 | 50 | # %% [markdown]
# # Time-series forecasting — PyCaret 4.0
#
# Input is a univariate `pandas.Series` (or a DataFrame with a named target column). `fh` is the forecast horizon.
# %%
# PyCaret 4.0 — OOP-only engine
# https://github.com/pycaret/pycaret
import warnings
warnings.filterwarnings("ignore")
import pycaret
prin... |
d1613d9cc5a4741145f82a3c5bf421b023211e58a58eaabc89cf2b6557a0b739 | Jupyter | 951 | 51 | # %% [markdown]
# # Anomaly detection — PyCaret 4.0
#
# Unsupervised: `create_model` picks the algorithm, `assign_model` labels every row with an anomaly score.
# %%
# PyCaret 4.0 — OOP-only engine
# https://github.com/pycaret/pycaret
import warnings
warnings.filterwarnings("ignore")
import pycaret
print("PyCaret", p... |
249137d0521e6fb5d94a809d54836b66c59fb3c2f1434b0ed063a9c8268cb12f | Jupyter | 1,011 | 48 | # %%
from custom import load_sequence_and_metadata, seq2chararray, encode_array, compute_seq_lengths, get_density_interval
from sklearn.decomposition import PCA
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
plt.style.use('fivethirtyeight')
sns.set_context('talk')
%load_... |
9806593c00decfb168d99ea6385059c28ed77cad39382fbf4051961811b2cf89 | Jupyter | 1,037 | 50 | # %% [markdown]
# # Computation of SHAP values for prediction of risk from clinical factors
# %%
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import shap
from sklearn.ensemble import (
RandomForestRegressor,
)
from tqdm.notebook import tqdm
median_risk_df = p... |
a58a2f6b90fa42d7bf331d93c42dbb1445def058a81d98b766da83c5e2d9bd8f | Jupyter | 1,037 | 56 | # %% [markdown]
# # Regression — PyCaret 4.0
#
# Predict a continuous target. Same shape as the classification notebook, different `Experiment` subclass.
# %%
# PyCaret 4.0 — OOP-only engine
# https://github.com/pycaret/pycaret
import warnings
warnings.filterwarnings("ignore")
import pycaret
print("PyCaret", pycaret.... |
6c1b5f55d837877cbfe16e8f421973b1edf441e8e1b222732d12c8e67ec50d5d | Jupyter | 1,054 | 42 | # %%
import sys
import os.path as op
import numpy as np
import nibabel as nib
from nilearn import plotting
sys.path.append(op.abspath("../"))
import utils
# %%
data_dir = op.abspath(op.join("..", "data"))
template_dir = op.join(data_dir, "templates")
# %%
subcortical_fn = op.join(template_dir, "rois-subcortical_mni... |
d245908e47db8b60180fcdd5bf0f4fdde152d3b2056633cc39f72f020779271c | Jupyter | 1,087 | 42 | # %%
from matplotlib import pyplot as plt
from matplotlib import colors as mcolors
import numpy as np
# %%
plt.rcParams['figure.figsize']=(10,10) #figure size
#plt.title('Trajectories 2x2',fontsize=20,ha='center') #title and position and size of it
#here you set the parameter for the construction of the circle
r=4.5... |
5484b526558a99d1039c205b5a3a82a832b71daa3a7ba936512c88f76bf6beb2 | Jupyter | 1,163 | 39 | # %%
import sys
sys.path.insert(0, '../')
from minisom import MiniSom
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
%matplotlib inline
%load_ext autoreload
# %%
%autoreload 2
import pandas as pd
data_url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/0039... |
c867fb59c738479d3a06f12a1d918fcdf7a7773d6abccdae7fdf72b8a7aa41c5 | Jupyter | 1,170 | 58 | # %% [markdown]
# # Clustering — PyCaret 4.0
#
# Unsupervised: no `target`, no `compare_models` / `tune_model`. You pick an algorithm with `create_model`, then call `assign_model` to label every row.
# %%
# PyCaret 4.0 — OOP-only engine
# https://github.com/pycaret/pycaret
import warnings
warnings.filterwarnings("ign... |
2489b738bab3198952ae178efa73abb1a0e6a2afc62296d2ba6044e406b8431f | Jupyter | 1,216 | 45 | # %% [markdown]
# Completeness is defined as the percentage of all synapses that are connected to identified optic lobe neurons.
#
# See "..\queries\completeness.py" for the exact definition.
# %%
"""
This cell does the initial project setup.
If you start a new script or notebook, make sure to copy & paste this par... |
dfc26c4de7d2f04c67d60c51adcf65e90457e91edbd46135c2522f2c662a388f | Jupyter | 1,220 | 48 | # %%
import pandas as pd
df = pd.read_csv('neuronbridge_accesses.csv')
max_count = df['Count'].max()
df.head()
# %%
import branca.colormap as cmp
colorscale = cmp.LinearColormap(
['blue', 'red'],
vmin=1, vmax=1000,
caption='Color Scale for Map' #Caption for Color scale or Legend
)
colorscale
# %%
import b... |
91b9a36841d442b1ad1faad36f8eabd2db83b15532640f5999a89c27ba228d1a | Jupyter | 1,256 | 56 | # %%
! sudo apt install build-essential swig
# %%
! wget https://repo.anaconda.com/archive/Anaconda3-2020.07-Linux-x86_64.sh
# %%
! bash Anaconda3-*-Linux-x86_64.sh -b
# %%
! ~/anaconda3/bin/pip list | grep scikit
# %%
! git clone https://github.com/automl/auto-sklearn.git
# %%
! cp auto-sklearn/requirements.txt .... |
fb2fa9bd53da88f369cf4df46bff818023871d9a534cc532062c8ae4e9db451e | Jupyter | 1,277 | 47 | # %%
import keypoint_moseq as kpms
project_dir = 'demo_project'
config = lambda: kpms.load_config(project_dir)
# %%
#only with GPU version
import os
cuda_path = os.environ['/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.3'] # or maybe cuda_path='/usr/local/cuda-11.0'
os.environ['XLA_FLAGS'] = '--xla_gpu_c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.