Datasets:
keyword stringclasses 7
values | repo_name stringlengths 8 98 | file_path stringlengths 4 244 | file_extension stringclasses 29
values | file_size int64 0 84.1M | line_count int64 0 1.6M | content stringlengths 1 84.1M ⌀ | language stringclasses 14
values |
|---|---|---|---|---|---|---|---|
2D | shigemorita/2Dpy | contour.py | .py | 2,436 | 70 | import numpy
import pandas
from matplotlib import pyplot
from matplotlib import ticker
data_file = "contour.csv"
num_contour = 16
pyplot.rcParams["axes.linewidth"] = 1.5
pyplot.rcParams["figure.dpi"] = 100
pyplot.rcParams["figure.figsize"] = (4, 4)
pyplot.rcParams["font.family"] = "serif"
pyplot.rcParams["font.size"] ... | Python |
2D | shigemorita/2Dpy | 2Dpy.py | .py | 2,013 | 68 | import math
import numpy
import pandas
from matplotlib import pyplot
hetero = False
inputfile1 = "spec.csv"
# hetero=True
# inputfile1="spec1.csv"
# inputfile2="spec2.csv"
left_large = True
dynamic = True
num_contour = 16
# file read
spec1 = pandas.read_csv(inputfile1, header=0, index_col=0).T
if hetero == False: i... | Python |
2D | shigemorita/2Dpy | contour.ipynb | .ipynb | 4,357 | 152 | {
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import numpy\n",
"import pandas\n",
"from matplotlib import pyplot\n",
"from matplotlib import ticker"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata... | Unknown |
2D | shigemorita/2Dpy | 2Dpy.ipynb | .ipynb | 3,678 | 141 | {
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import math\n",
"import numpy\n",
"import pandas\n",
"from matplotlib import pyplot"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs... | Unknown |
2D | GiggleLiu/QuantumMPS | resolve_env.jl | .jl | 386 | 20 | using Pkg
deps = ["Yao", "DelimitedFiles", "FileIO", "Fire", "JLD2", "KrylovKit", "StatsBase"]
extras = ["CUDAnative", "CuArrays"]
USE_CUDA = !("nocuda" in ARGS)
if USE_CUDA
deps = vcat(deps, extras)
end
for x in deps
println("Installing $x ...")
Pkg.add(x)
end
if USE_CUDA
println("Installing CuYao ... | Julia |
2D | GiggleLiu/QuantumMPS | j1j2.jl | .jl | 2,133 | 61 | include("applications.jl")
using Fire
@main function sample_cluster()
m = model(Val(:cluster); nbit=3, B=10)
@show gensample(m, X)
end
"""
julia j1j2.jl train [--symmetry <su2|u1|general>] [--depth <Int>]
Train a 4 x 4 frustrated Heisenberg model with J2 = 0.5.
Available ansatz symmetries includes `gene... | Julia |
2D | GiggleLiu/QuantumMPS | applications.jl | .jl | 4,101 | 126 | push!(LOAD_PATH, abspath("src"))
using Yao
using QMPS
using DelimitedFiles, JLD2, FileIO, Pkg
# CUDA switch
const USE_CUDA = haskey(Pkg.installed(), "CuYao")
USE_CUDA && println("Hint: Using CUDA since `CuYao` is detected. Edit file `applications.jl` to modify CUDA settings, like switching computing devices.")
USE_CUD... | Julia |
2D | GiggleLiu/QuantumMPS | CuChem.jl | .jl | 292 | 10 | using CUDAnative, CuArrays
using CUDAnative: device!, devices, CuDevice
using CuYao
import CuYao: cu
CuArrays.allowscalar(false)
function cu(chem::QuantumMPS)
QuantumMPS(chem.nbit_measure, chem.nbit_virtual, chem.nbit_ancilla, chem.circuit, chem.initial_reg |> cu, chem.input_state)
end
| Julia |
2D | GiggleLiu/QuantumMPS | TFI_onefile.jl | .jl | 3,911 | 130 | using Yao
using Statistics: mean
using LinearAlgebra
rotor(noleading::Bool=false, notrailing::Bool=false) = noleading ? (notrailing ? Rx(0) : chain(Rx(0), Rz(0))) : (notrailing ? chain(Rz(0), Rx(0)) : chain(Rz(0), Rx(0), Rz(0)))
function twoqubit_circuit(nlayer::Int, nrepeat::Int)
nbit_measure = nbit_virtual = 1
... | Julia |
2D | GiggleLiu/QuantumMPS | chainmodel.jl | .jl | 1,080 | 32 | include("applications.jl")
function train(nsite;depth::Int=2)
symmetry = :twoqubit
model = TFI(nsite; h=0.5, periodic=false)
ansatz = simple_ansatz(nsite, symmetry, depth; load_params=false)
run_train(ansatz, model; SAVE_ID=Symbol(symmetry,:_d,depth), niter=500, start_point=0)
end
function measure(ta... | Julia |
2D | GiggleLiu/QuantumMPS | src/TFI.jl | .jl | 1,078 | 44 | export TFI
struct TFI{D} <: AbstractModel{D}
size::NTuple{D, Int}
h::Float64
periodic::Bool
TFI(size::Int...; h::Real, periodic::Bool) = new{length(size)}(size, Float64(h), periodic)
end
function get_bonds(model::TFI{1})
nbit, = model.size
[(i, i%nbit+1, 1.0) for i in 1:(model.periodic ? nbit ... | Julia |
2D | GiggleLiu/QuantumMPS | src/Adam.jl | .jl | 972 | 41 | export Adam, update!
mutable struct Adam
lr::AbstractFloat
gclip::AbstractFloat
beta1::AbstractFloat
beta2::AbstractFloat
eps::AbstractFloat
t::Int
fstm
scndm
end
Adam(; lr=0.001, gclip=0, beta1=0.9, beta2=0.999, eps=1e-8)=Adam(lr, gclip, beta1, beta2, eps, 0, nothing, nothing)
functi... | Julia |
2D | GiggleLiu/QuantumMPS | src/gradient.jl | .jl | 1,173 | 39 | export QMPSOptimizer, gradients_exact
struct QMPSOptimizer
chem::QuantumMPS
model::AbstractModel
optimizer
diff_blocks
params::Vector
QMPSOptimizer(chem::QuantumMPS, model::AbstractModel, optimizer) = new(chem, model, optimizer, collect_blocks(AbstractDiff, chem.circuit), parameters(chem.circui... | Julia |
2D | GiggleLiu/QuantumMPS | src/correlation.jl | .jl | 1,928 | 60 | export measure_corr
"""
measure correlator.
e.g. measure_corr(chem, 1=>X, 3=>X) will measure <σₓ¹σₓ³> from a quantum MPS.
"""
function measure_corr(chem::QuantumMPS, si::Pair{Int, <:PauliGate}, sj::Pair{Int, <:PauliGate})
si.first > sj.first && return measure_corr(chem, sj, si)
si.first == sj.first && throw(A... | Julia |
2D | GiggleLiu/QuantumMPS | src/AbstractModel.jl | .jl | 1,050 | 41 | export AbstractModel, Heisenberg
export heisenberg_ij, hamiltonian, heisenberg_term, ground_state, energy, energy_exact, get_bonds, energy, heisenberg_2d, nspin
abstract type AbstractModel{D} end
abstract type AbstractHeisenberg{D} <: AbstractModel{D} end
nspin(model::AbstractModel) = prod(size(model))
"""
energ... | Julia |
2D | GiggleLiu/QuantumMPS | src/Core.jl | .jl | 2,936 | 90 | export getblock, nbit_used, nbit_simulated, nrepeat, expand_circuit, QuantumMPS
export state_exact, fidelity_exact
export gensample
"""
QuantumMPS{RT}
Members:
`nbit_measure`, number of qubits measured in a single iteration, or physical qubits.
`nbit_virtual`, number of virtual qubits to represent the vir... | Julia |
2D | GiggleLiu/QuantumMPS | src/J1J2.jl | .jl | 1,535 | 55 | export J1J2
"""
J1J2{D} <: AbstractHeisenberg{D}
frustrated Heisenberg model.
"""
struct J1J2{D} <: AbstractHeisenberg{D}
size::NTuple{D, Int}
periodic::Bool
J2::Float64
J1J2(size::Int...; J2::Real, periodic::Bool) = new{length(size)}(size, periodic, Float64(J2))
end
Base.size(model::J1J2) = mode... | Julia |
2D | GiggleLiu/QuantumMPS | src/Heisenberg.jl | .jl | 1,635 | 51 | struct Heisenberg{D} <: AbstractHeisenberg{D}
size::NTuple{D, Int}
periodic::Bool
Heisenberg(size::Int...; periodic::Bool) = new{length(size)}(size, periodic)
end
Base.size(model::Heisenberg) = model.size
heisenberg_ij(nbit::Int, i::Int, j::Int=i+1) = put(nbit, i=>X)*put(nbit, j=>X) + put(nbit, i=>Y)*put(... | Julia |
2D | GiggleLiu/QuantumMPS | src/QMPS.jl | .jl | 370 | 22 | module QMPS
using Yao
using Yao.ConstGate: SWAP
using BitBasis: packbits
using StatsBase
using StatsBase: mean
using LinearAlgebra
using KrylovKit
using QuAlgorithmZoo
PauliGate{T} = Union{XGate{T}, YGate{T}, ZGate{T}}
include("Adam.jl")
include("Core.jl")
include("AbstractModel.jl")
include("gradient.jl")
include(... | Julia |
2D | GiggleLiu/QuantumMPS | src/ansatz/su2_circuit.jl | .jl | 1,700 | 51 | function su2_unit(nbit::Int, i::Int, j::Int)
put(nbit, (i,j)=>rot(SWAP, 0.0))
end
"""
su2_circuit(nbit_virtual::Int, nlayer::Int, nrepeat::Int, pairs::Vector) -> Sequence
SU(2) symmetry quantum circuit ansatz for evolving states in S^2 = 0 good quantum number block. It requires `2+nbit_virtual` qubits, `pairs... | Julia |
2D | GiggleLiu/QuantumMPS | src/ansatz/general_circuit.jl | .jl | 2,153 | 62 | using Yao
export random_circuit, pair_ring
"""
pair_ring(n::Int) -> Vector
Pair ring.
"""
pair_ring(n::Int) = [i=>mod(i, n)+1 for i=1:n]
"""
cnot_entangler(n::Int, pairs::Vector{Pair}) = ChainBlock
Arbitrary entangler unit, support lazy construction.
"""
cnot_entangler(n::Int, pairs) = chain(n, control(n, ... | Julia |
2D | GiggleLiu/QuantumMPS | src/ansatz/ansatz.jl | .jl | 531 | 19 | export model
"""
model(which::Symbol; nbit::Int, V::Int, B::Int=4096, nlayer::Int=5)
predefined models, `which` should be one of :random, :u1, :su2.
* `nbit` is the system size (length of MPS),
* `V` is the number of virtual qubits,
* `B` is the batch size.
* `nlayer` is the number of layers in a block.
"""
model... | Julia |
2D | GiggleLiu/QuantumMPS | src/ansatz/twoqubit_circuit.jl | .jl | 946 | 28 | export twoqubit_circuit
function twoqubit_circuit(nlayer::Int, nrepeat::Int)
nbit_measure = nbit_virtual = 1
nbit_used = nbit_measure + nbit_virtual
circuit = chain(nbit_used)
for i=1:nrepeat
unit = chain(nbit_used)
for j=1:nlayer
push!(unit, put(nbit_used, 1=>rotor(true, f... | Julia |
2D | GiggleLiu/QuantumMPS | src/ansatz/cluster.jl | .jl | 479 | 14 | cluster_block(isfirst::Val{true}) = chain(2, [repeat(2, H, 1:2), control(2, 1, 2=>Z)])
cluster_block(isfirst::Val{false}) = chain(2, [swap(2, 1, 2), put(2, 2=>H), control(2, 1, 2=>Z)])
function cluster_circuit(nrepeat::Int)
sequence([cluster_block(Val(i==1)) for i=1:nrepeat])
end
function model(::Val{:cluster}; n... | Julia |
2D | GiggleLiu/QuantumMPS | src/ansatz/u1_circuit.jl | .jl | 1,115 | 36 | function u1_unit(nbit::Int, i::Int, j::Int)
chain(nbit, put(nbit, i=>Rz(0)),
put(nbit, j=>Rz(0)),
put(nbit, (i,j)=>rot(SWAP, 0))
)
end
"""
u1_circuit(nbit_measure::Int, nbit_virtual::Int, nlayer::Int, nrepeat::Int, entangler_pairs) -> Sequence
U(1) symmetric quantum circuit ansatz.
"""
function u1... | Julia |
2D | GiggleLiu/QuantumMPS | test/runtests.jl | .jl | 3,587 | 82 | push!(LOAD_PATH, abspath("src"))
using Yao
using LinearAlgebra, Statistics
using BitBasis: packbits
using QMPS
using Test, Random
# make it cluster state
@testset "convert wave function check" begin
chem = model(:su2; nbit=9, nlayer=2, B=10, V=5, pairs=pair_ring(5))
c = random_circuit(1, 4, 2, 5, pair_ring(5))... | Julia |
2D | daihui/QuantumWalkSimulation | classicalRW.py | .py | 1,583 | 58 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'levitan'
import math
from numpy import *
import numpy as np
import random
from matplotlib import pyplot as plt
def classicalRanNum():
coinX = int(random.choice(['1', '-1']))
coinY = int(random.choice(['1', '-1']))
return coinX, coinY
# print c... | Python |
2D | daihui/QuantumWalkSimulation | AnimatedScatter.py | .py | 4,512 | 125 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'levitan'
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from numpy import *
import QWithDiffShift as QDS
import time
class AnimatedScatterQW(object):
"""An animated scatter plot using matplotlib.animations.FuncAnimation."""
... | Python |
2D | daihui/QuantumWalkSimulation | quantumRWTest.py | .py | 582 | 23 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'levitan'
import quantumRW as QW
from numpy import *
from matplotlib import pyplot as plt
import quantumRWMat as QWM
totalSteps=100
plotSteps=10
# steps=50
# qwalker= QW.distriQW(1/sqrt(2),1j/sqrt(2),1/sqrt(2),1j/sqrt(2),steps,1)
#QW.Plot2D(qwalker)
#QW.Plot... | Python |
2D | daihui/QuantumWalkSimulation | quantumRWMat.py | .py | 5,568 | 143 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'levitan'
"""
This is matrix release for 2D quantum walk simulation.
量子游走的基本过程:有一个初始量子态,coin是一个幺正变换,一次游走即coin对量子态变换一次
然后根据量子态walk一步,得到一个位置概率分布,如此反复。
"""
from numpy import *
from matplotlib import pyplot as plt
# 初始化量子态,是一个对角矩阵
def initQuanStat(X0, X1, Y0, Y... | Python |
2D | daihui/QuantumWalkSimulation | QWithDiffShiftTest.py | .py | 3,092 | 86 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'levitan'
from numpy import *
from matplotlib import pyplot as plt
import QWithDiffShift as QDS
# distribution=QDS.QWDistribution(1/sqrt(2),1j/sqrt(2),700,1)
# QDS.PlotX(distribution)
def QDSPlot(X0, X1, steps, shiftGateNum):
for step in range(1, steps ... | Python |
2D | daihui/QuantumWalkSimulation | classicalRWMat.py | .py | 1,888 | 54 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
__author__ = 'levitan'
"""
This is a matrix release for 2D classic random walk simulation.
经典随机游走的基本过程:在一个初始位置,投一次coin(随机选择),根据coin的结果,
选择向某一个方向走一步,然后再投一次coin,周而复始。
classicalRanMun():产生一个随机coin
classcalWalkerPosition():walker的初始位置,设为(0,0)
classicalWalk():根据参数walkNum随机游走wal... | Python |
2D | daihui/QuantumWalkSimulation | QWithDiffShift.py | .py | 25,076 | 598 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'levitan'
"""
This is matrix release for 1D quantum walk with different shift simulation(graph).
基本过程:有一个初始量子态,coin是一个幺正变换,一次游走即coin对量子态变换一次
然后根据量子态walk一步,或几步(根据shift而定)得到一个位置概率分布,如此反复。
"""
from numpy import *
from matplotlib import pyplot as plt
import time
... | Python |
2D | daihui/QuantumWalkSimulation | quantumRW.py | .py | 7,551 | 163 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'levitan'
from numpy import *
from matplotlib import pyplot as plt
import copy
dimension = 1
def initQuantumStateList(X0, X1, Y0, Y1, totalSteps):
initquantumStateList = zeros([2 * totalSteps + 1, 2 * totalSteps + 1, 2, 2], dtype=complex)
initquant... | Python |
End of preview. Expand in Data Studio
DATA1: Domain-Specific Code Dataset
Dataset Overview
DATA1 is a large-scale domain-specific code dataset focusing on code samples from interdisciplinary fields such as biology, chemistry, materials science, and related areas. The dataset is collected and organized from GitHub repositories, covering 178 different domain topics with over 1.1 billion lines of code.
Dataset Statistics
- Total Datasets: 178 CSV files
- Total Data Size: ~115 GB
- Total Lines of Code: Over 1.1 billion lines
- Data Format: CSV (Comma-Separated Values)
- Encoding: UTF-8
Dataset Structure
Each CSV file corresponds to a specific domain topic, with the naming format dataset_{Topic}.csv, where {Topic} is the domain keyword (e.g., Protein, Drug, Genomics).
Data Field Description
Each CSV file contains the following fields:
| Field Name | Type | Description |
|---|---|---|
keyword |
String | Domain keyword used to identify the domain of the code sample |
repo_name |
String | GitHub repository name (format: owner/repo) |
file_path |
String | Relative path of the file in the repository |
file_extension |
String | File extension (e.g., .py, .java, .cpp) |
file_size |
Integer | File size in bytes |
line_count |
Integer | Number of lines of code in the file |
content |
String | Complete file content |
language |
String | Programming language (e.g., Python, Java, C++) |
Domain Categories
The dataset covers the following major domain categories:
Biology-Related
- Molecular Biology: Protein, DNA, RNA, Gene, Enzyme, Receptor, Ligand
- Cell Biology: Cell_biology, Single_cell, Cell_atlas, Organoid
- Genomics: Genomics, Genotype, Phenotype, Epigenetics, Metagenomics
- Transcriptomics: Transcriptomics, Spatial_Transcriptomics, Transcription, Translation
- Proteomics: Proteomics, Protein_Protein_Interactions, Folding
- Metabolomics: Metabolomics, Metabolic, Lipidomics, Glycomics
- Systems Biology: System_biology, Signaling, Pathway, Networks
Chemistry-Related
- Computational Chemistry: Computational_Chemistry, Quantum_Chemistry, DFT, QM_MM
- Medicinal Chemistry: Drug, ADMET, QSAR, Docking, Lead_discovery, Lead_optimization
- Materials Chemistry: Material, Crystal, Conformation, Chemical_space
- Reaction Chemistry: Reaction, Kinetics, Mechanism, Redox
Medicine and Pharmacology
- Pharmacology: Pharmacology, Pharmacokinetics, Pharmacogenomics, Pharmacogenetics
- Medicine: Medicine, Disease, Diagnostics, Pathology, Vaccine
- Toxicology: Toxicology, Biomarker, Marker
Computational Methods
- Machine Learning: Transformer, GAN, VAE, Diffusion, Flow_matching, Reinforcement_learning
- Quantum Computing: Quantum_mechanics, Quantum_biology, Electronic_structure
- Modeling Methods: Modeling, Multi_scale_modeling, Agent_based_model, Stochastic_modeling
- Numerical Methods: Monte_Carlo, Finite_element_method, Phase_field_technique
Other Specialized Fields
- Bioinformatics: Bioinformatics, Cheminformatics, Next_generation_sequencing
- Bioengineering: Bioengineering, Biotechnology, Biosensors
- Immunology: Immunology, Antibody, Antigen, Antagonist
- Virology: Viral, Pandemic, Pathogens, AMR (Antimicrobial Resistance)
Data Source
The data is collected from open-source repositories on GitHub through the following process:
- Keyword Search: Search for relevant repositories on GitHub using domain-specific keywords
- Repository Filtering: Filter repositories based on relevance scores and code quality
- File Extraction: Extract code files from filtered repositories
- Categorization: Classify files into corresponding topic datasets based on keywords and domain characteristics
Dataset Characteristics
- Wide Domain Coverage: Covers multiple interdisciplinary fields including biology, chemistry, materials science, and medicine
- Diverse Code Types: Includes multiple programming languages such as Python, Java, C++, R, and MATLAB
- Large Scale: Over 1.1 billion lines of code with a total data size of 115 GB
- Structured Storage: Each domain topic is stored independently as a CSV file for convenient on-demand usage
- Rich Metadata: Contains comprehensive metadata including repository information, file paths, and language types
Usage Guidelines
Data Loading
import pandas as pd
# Load dataset for a specific domain
df = pd.read_csv('dataset_Protein.csv')
# View basic dataset information
print(f"Dataset size: {len(df)} files")
print(f"Programming language distribution: {df['language'].value_counts()}")
print(f"File type distribution: {df['file_extension'].value_counts()}")
Data Filtering
# Filter by programming language
python_files = df[df['language'] == 'Python']
# Filter by file size (e.g., files smaller than 100KB)
small_files = df[df['file_size'] < 100000]
# Filter by line count
medium_files = df[(df['line_count'] > 50) & (df['line_count'] < 1000)]
Domain-Specific Analysis
# Analyze code characteristics for a specific domain
protein_df = pd.read_csv('dataset_Protein.csv')
print(f"Number of code files in Protein domain: {len(protein_df)}")
print(f"Average file size: {protein_df['file_size'].mean():.2f} bytes")
print(f"Average line count: {protein_df['line_count'].mean():.2f} lines")
Important Notes
- File Size: Some dataset files are large (up to several GB), please be mindful of memory usage when loading
- Encoding: All files use UTF-8 encoding; ensure proper handling of special characters if encountered
- Data Quality: Data is sourced from public repositories and may vary in code quality; preprocessing is recommended before use
- License Compliance: Please comply with the license requirements of the original repositories when using the data
- Downloads last month
- 17