Scans.jl
Luna.Scans.AbstractExec
— TypeAbstractExec
Abstract supertype for scan execution modes.
Luna.Scans.BatchExec
— TypeBatchExec(Nbatches, batch)
Execution mode to divide the scan into Nbatches
chunks and run only the given batch
.
Luna.Scans.CondorExec
— TypeCondorExec(scriptfile, ncores)
Execution mode which submits a scan to an HTCondor queue system claiming ncores
cores.
scriptfile
must always be @__FILE__
Luna.Scans.LocalExec
— TypeLocalExec
Execution mode to simply run the whole scan in the current Julia session in a for
loop.
Luna.Scans.QueueExec
— TypeQueueExec(nproc=0, queuefile="")
Execution mode to run a scan using a file-based queueing system. Can be run in multiple separate Julia sessions, or can spawn nproc
subprocesses which then take items from the queue to run.
Possible values for nproc
are:
0
: run only in the current Julia processn > 0
: spawnn
subprocesses and run on these-1
: spawn as many subprocesses as the number of logical cores on the CPU (Base.Sys.CPU_THREADS
)
If queuefile
is given, the queuefile is stored at that path. If omitted, the queuefile is stored in Utils.cachedir()
. Note that the queuefile is deleted at the end of the scan.
Luna.Scans.RangeExec
— TypeRangeExec(range)
Execution mode to run a subsection of the scan, given by a UnitRange
, in the current Julia session.
Luna.Scans.SSHExec
— TypeSSHExec(localexec, scriptfile, hostname, subdir)
Execution mode which transfers the scriptfile
file to the host given by hostname
via SSH and executes the scan on that host with a mode defined by localexec
. subdir
gives the subdirectory (relative to the home directory) where scans are stored on the remote host. A subfolder with automatically chosen name will be created in subdir
to store this scan.
scriptfile
must always be @__FILE__
Luna.Scans.Scan
— TypeScan(name; kwargs...)
Scan(name, ex::AbstractExec; kwargs...)
Create a new Scan
with name name
and variables given as keyword arguments. The execution mode ex
can be given directly or via command-line arguments to the script. If given, command-line arguments overwrite any explicitly passed execution mode.
If neither an explicit execution mode nor command-line arguments are given, ex
defaults to LocalExec
, i.e. running the whole scan locally in the current Julia process.
Luna.Scans.addvariable!
— Methodaddvariable!(scan, variable::Symbol, array)
addvariable!(scan; kwargs...)
Add scan variable(s) to the scan
, either as a single pair of Symbol
and array, or as a sequence of keyword arguments.
Luna.Scans.chunks
— Methodchunks(a::AbstractArray, n::Int)
Split array a into n chunks, spreading the entries of a evenly.
Examples
julia> a = collect(range(1, length=10));
julia> Scans.chunks(a, 3)
3-element Array{Array{Int64,1},1}:
[1, 4, 7, 10]
[2, 5, 8]
[3, 6, 9]
Luna.Scans.makefilename
— Methodmakefilename(scan, scanidx)
Make an appropriate file name for an HDF5Output
or prop_capillary
output for the scan
at the current scanidx
.
Examples
scan = Scan("scan_example"; energy=collect(range(5e-6, 200e-6; length=64)))
runscan(scan) do scanidx, energyi
prop_capillary(125e-6, 3, :He, 0.8; λ0=800e-9, τfwhm=10e-15, energy=energyi
filepath=makefilename(scan, scanidx))
end
Luna.Scans.runscan
— Methodrunscan(f, scan)
Run the function f
in a scan with arguments defined by the scan::Scan
. The function f
must have the signature f(scanidx, args...)
where the length of args
is the number of variables to be scanned over. Can be used with the do
block syntax.
The exact subset and order of scan points which is run depends on scan.exec
, see Scan
.
Examples
scan = Scan("scan_example"; energy=collect(range(5e-6, 200e-6; length=64)))
runscan(scan) do scanidx, energyi
prop_capillary(125e-6, 3, :He, 0.8; λ0=800e-9, τfwhm=10e-15, energy=energyi)
end