A package for generating input files for QuantumDetectors Scan Engine.
Press ]
in a Julia REPL to access package mode, then for using the package:
pkg> add [email protected]:chenspc/QDScan.jl.git
or for development:
pkg> dev [email protected]:chenspc/QDScan.jl.git
p = make_pattern(8, 8; pattern="raster", visual="lineplot");
p = make_pattern(8, 8; pattern="serpentine", visual="lineplot");
p = make_pattern(8, 8; pattern="hilbert", visual="lineplot");
p = make_pattern(8, 8; pattern="spiral", visual="lineplot");
p = make_pattern(8, 8, 2; pattern="interleave", visual="heatmap");
p = make_pattern(9, 9, 3; pattern="interleave", visual="heatmap");
p = make_pattern(6, 6, (2, 3); pattern="interleave", visual=["matrix", "heatmap"]);
p = make_pattern(16, 16; pattern="random", visual="heatmap", seed=1234);
p = make_pattern(10, 10, 0.1; pattern="sparse", visual=["matrix", "heatmap"], seed=1234);
make_pattern(10, 10; pattern="sparse", visual="heatmap") == make_pattern(10, 10, 0.5; pattern="sparse", visual="heatmap", seed=2023)
- Any matrix with positive integer elements that do not repeat can be converted into a pattern. Simply give the matrix as the first input to
make_pattern
. - Julia matrices are column major, counting first from top to bottom, while scan patterns are typically displayed from left to right first, hence appearing transposed after the
make_pattern
function. - QD Scan Engine use 0-based index, so the pattern coordinates need to subtract 1, or (1, 1).
- QD Scan Engine accepts either coordinates as
(x, y)
orx + y*x_size
. Use the optionallinear_index
variable to toggle the output.
julia> A = random_pattern(2, 3)
2×3 Matrix{Int64}:
5 4 1
6 3 2
julia> p = make_pattern(A; pattern="premade")
3×2 adjoint(::Matrix{Int64}) with eltype Int64:
5 6
4 3
1 2
6-element Vector{Tuple{Int64, Int64}}:
(0, 2)
(1, 2)
(1, 1)
(0, 1)
(0, 0)
(1, 0)
julia> p = make_pattern(A; pattern="premade", linear_index=true)
3×2 adjoint(::Matrix{Int64}) with eltype Int64:
5 6
4 3
1 2
6-element Vector{Int64}:
4
5
3
2
0
1
The make_pattern
function can accept a complex matrix as input. When an element is real, the probe will stop for one dwell period before moving onto the next. A complex element in the matrix, e.g. 4 + 2im
means dwelling at position 4
for 3 periods (1 default + 2 additional).
julia> B = A .+ 2im
2×3 Matrix{Complex{Int64}}:
5+2im 4+2im 1+2im
6+2im 3+2im 2+2im
julia> ppp = make_pattern(B; pattern="premade", linear_index=true)
3×2 adjoint(::Matrix{Int64}) with eltype Int64:
5 6
4 3
1 2
18-element Vector{Int64}:
4
4
4
5
5
5
3
3
3
2
2
2
0
0
0
1
1
1
One can also simply repeat the whole pattern by providing the optional multipass
variable
julia> px3 = make_pattern(A; pattern="premade", linear_index=true, multipass=3)
3×2 adjoint(::Matrix{Int64}) with eltype Int64:
5 6
4 3
1 2
18-element Vector{Int64}:
4
5
3
2
0
1
4
5
3
2
0
1
4
5
3
2
0
1
save_pattern("test_pattern.csv", p)