@include(inc_dependencies.htm)
[[TABS]] [[SIDEBAR]]
[[CONTENT]]
Add Entry
Format: [[FORMAT]]
Saved!
Kind:
Outgoing Money (we have to pay)
Incoming Money (we get paid)
X
Date in YYYY-MM-DD or DD. MM. YYYY:
Title:
Category:
Originator:
Amount before tax:
€
Tax percentage:
%
Amount after tax:
€
Save
Save & Exit
Reset
Exit
You are adding a paid by date to this entry:
The entry...
Has been paid
Has not yet been paid
Paid by Date:
Paid
to
Account:
Save Changes
Cancel
Do you really want to delete the
'
'?
Yes
Cancel


If you're reading this blog, you've likely read an argument at some point that \(.999... = 1\). However, if this is completely new information to you: no, this is not a joke. These two decimal forms represent the same quantity. Their difference is exactly equal to zero. One common way this is 'proven' is via the following argument:
$$\frac{1}{3} = .333... \implies 3 \cdot \left(\frac{1}{3}\right) = 3 \cdot \left(.333...\right) \implies 1 = .999...$$While the manipulations here are valid, if this argument feels like 'cheating' to you (it does to me), you may be more conviced by this alternate proof:
$$x = .999\dots \\ \implies \\ 10x = 9.999\dots \\ \implies \\ 10x - x = 9.999... - x \\ \implies \\ 9x = 9.999... - .999\dots \\ \implies \\ 9x = 9 \\ \implies \\ x = 1 $$Perhaps now you are more convinced. Unfortunately, most discussions of the subject would end here, with the reader perhaps now believing in the seemingly paradoxical identity, or perhaps not. But the fact is that a mathematician would not be satisfied by the arguments presented thus far. The reason for this is that there is simply far too much ambiguity in the expression "\(.999...\)". In order to make sure all the mathematics presented above is actually is well founded, we need to explain what an infinitely repeating decimal is.
Perhaps nailing down the meaning of \(.999...\) seems unnecessary; you learned about repeating decimals in middle school! But to demonstrate the necessity of this formality, I offer a variety of seemingly plausible descriptions of what the expression represents (paraphrased from Wikipedia):
- \(.999...\) represents an unimaginably large but finite string of 9s
- \(.999...\) represents a string of 9s with a unspecified, variable length
- \(.999...\) represents an infinite string of 9s with a 9 "at infinity"
- \(.999...\) represents a sequence of decimals values: \(.9, .99, .999, ...\)
None of these descriptions actually reflect how the quantity is defined! In fact to understand the definition of \(.999...\) requires some math that is not usually discussed until a real analysis course, but I will introduce it here.
Sequences
First, a disclaimer. This post will put one closer to understanding the rigorous mathematical foundation upon which the statement \(.999... = 1\) sits. However, it is still not complete. To fill in the remaining details we would need to give the definition of real numbers, show they satisfy the completeness or least upper bound property, et cetera. However, this would be a long, dry discussion, and I think misses the essence of the concept. So, for those with education up to real analysis, forgive my brevity ahead.
Formally, a (real) sequence is a mapping, \(f : \mathbb{N} \rightarrow \mathbb{R}\). What this means intuitively is that a sequence is a "list" of real numbers indexed by naturals - there is a first, second, third element, and so on. Often, a sequence will be denoted \(\{a_n\}\) where \(a_n\) is the \(n\)th term of the sequence. Thus, for example, \(\{\frac{1}{2^n}\} = (1, \frac{1}{2}, \frac{1}{4}, \frac{1}{8}, ...)\).
Some sequences "converge to a limit". Formally, \(\{a_n\}\) converges to \(L\) if \(\forall \epsilon > 0. \; \exists n_0 \in \mathbb N. \; \forall n > n_0. \; a_n \in (L - \epsilon, L + \epsilon)\). What this means intuitively is that \(\{a_n\}\) converges to \(L\) if as \(n\) tends towards infinity, the difference between \(a_n\) and \(L\) gets (arbitrarily) close to 0. In particular, you could demand "I want the difference between \(a_n\) and \(L\) to be no greater than \(\epsilon\)", and no matter your choice of \(\epsilon\), I would be able to find you an index \(n\) beyond which the sequence is always at least that close to \(L\). For example: \(\{\frac{1}{2^n}\}\) converges to 0 because it gets arbitrarily close to 0. For shorthand we write \(\lim\limits_{n\rightarrow\infty} \frac{1}{2^n} = 0\).
Defining \(.999...\)
We now have the machinery needed to define \(.999...\). Specifically, it is defined as the limit of the sequence (\(.9, .99, .999, ...\)). That is, \(.999...\) is shorthand for the expression \(\lim\limits_{n \rightarrow \infty} \underbrace{.999...9}_\textrm{\(n\) times}\).
Then, at last, as the sequence (\(.9, .99, .999, ...\)) grows arbitrarily close to 1, we have \(.999... = \lim\limits_{n \rightarrow \infty} \underbrace{.999...9}_\textrm{\(n\) times} = 1\).


Divide the line in half.
Now you have two lines, each half as small as the original:
The problem "divide the line into 16 equal pieces" has been transformed into two smaller problems: "divide each of two lines into 8 equal pieces.
How do you solve the smaller problems?


{# rename_groups_to_topics #}
{% trans %} You can use CKAN Topics to create and manage collections of datasets. This could be to catalogue datasets for a particular project or team, or on a particular theme, or as a very simple way to help people find and search your own published datasets. {% endtrans %}


# -*- coding: utf-8 -*-
# This file is part of QuTiP: Quantum Toolbox in Python.
#
# Copyright (c) 2011 and later, Paul D. Nation and Robert J. Johansson.
# All rights reserved.
#
# 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 retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the QuTiP: Quantum Toolbox in Python nor the names
# of its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
 IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
###############################################################################
#
# This module was initially contributed by Ben Criger.
#
"""
This module implements transformations between superoperator representations,
including supermatrix, Kraus, Choi and Chi (process) matrix formalisms.
"""
__all__ = ['super_to_choi', 'choi_to_super', 'choi_to_kraus', 'kraus_to_choi',
'kraus_to_super', 'choi_to_chi', 'chi_to_choi', 'to_choi',
'to_chi', 'to_super', 'to_kraus', 'to_stinespring'
]
# Python Standard Library
from itertools import starmap, product
# NumPy/SciPy
from numpy.core.multiarray import array, zeros
from numpy.core.shape_base import hstack
from numpy.matrixlib.defmatrix import matrix
from numpy import sqrt, floor, log2
from numpy import dot
from scipy.linalg import eig, svd
# Needed to avoid conflict with itertools.product.
import numpy as np
# Other QuTiP functions and classes
from qutip.superoperator import vec2mat, operator_to_vector, sprepost
from qutip.operators import identity, sigmax, sigmay, sigmaz
from qutip.tensor import tensor, flatten
from qutip.qobj import Qobj
from qutip.states import basis
# SPECIFIC SUPEROPERATORS -----------------------------------------------------
def _dep_super(pe):
"""
Returns the superoperator corresponding to qubit depolarization for a
given parameter pe.
TODO: if this is going into production (hopefully it isn't) then check
CPTP, expand to arbitrary dimensional systems, etc.
"""
return Qobj(dims=[[[2], [2]], [[2], [2]]],
inpt=array([[1. - pe / 2., 0., 0., pe / 2.],
[0., 1. - pe, 0., 0.],
[0., 0., 1. - pe, 0.],
[pe / 2., 0., 0., 1. - pe / 2.]]))
def _dep_choi(pe):
"""
Returns the choi matrix corresponding to qubit depolarization for a
given parameter pe.
TODO: if this is going into production (hopefully it isn't) then check
CPTP, expand to arbitrary dimensional systems, etc.
"""
return Qobj(dims=[[[2], [2]], [[2], [2]]],
inpt=array([[1. - pe / 2., 0., 0., 1. - pe],
[0., pe / 2., 0., 0.],
[0., 0., pe / 2., 0.],
[1. - pe, 0., 0., 1. - pe / 2.]]),
superrep='choi')
# CHANGE OF BASIS FUNCTIONS ---------------------------------------------------
# These functions find change of basis matrices, and are useful in converting
# between (for instance) Choi and chi matrices. At some point, these should
# probably be moved out to another module.
_SINGLE_QUBIT_PAULI_BASIS = (identity(2), sigmax(), sigmay(), sigmaz())
def _pauli_basis(nq=1):
# NOTE: This is slow as can be.
# TODO: Make this sparse. CSR format was causing problems for the [idx, :]
# slicing below.
B = zeros((4 ** nq, 4 ** nq), dtype=complex)
dims = [[[2] * nq] * 2] * 2
for idx, op in enumerate(starmap(tensor,
product(_SINGLE_QUBIT_PAULI_BASIS,
repeat=nq))):
B[:, idx] = operator_to_vector(op).dag().full()
return Qobj(B, dims=dims)
# PRIVATE CONVERSION FUNCTIONS ------------------------------------------------
# These functions handle the main work of converting between representations,
# and are exposed below by other functions that add postconditions about types.
#
# TODO: handle type='kraus' as a three-index Qobj, rather than as a list?
def _super_tofrom_choi(q_oper):
"""
We exploit that the basis transformation between Choi and supermatrix
representations squares to the identity, so that if we munge Qobj.type,
we can use the same function.
Since this function doesn't respect :attr:`Qobj.type`, we mark it as
private; only those functions which wrap this in a way so as to preserve
type should be called externally.
"""
data = q_oper.data.toarray()
dims = q_oper.dims
new_dims = [[dims[1][1], dims[0][1]], [dims[1][0], dims[0][0]]]
d0 = np.prod(np.ravel(new_dims[0]))
d1 = np.prod(np.ravel(new_dims[1]))
s0 = np.prod(dims[0][0])
s1 = np.prod(dims[1][1])
return Qobj(dims=new_dims,
inpt=data.reshape([s0, s1, s0, s1]).
transpose(3, 1, 2, 0).reshape((d0, d1)))
def _isqubitdims(dims):
"""Checks whether all entries in a dims list are integer powers of 2.
Parameters
----------
dims : nested list of ints
Dimensions to be checked.
Returns
-------
isqubitdims : bool
True if and only if every member of the flattened dims
list is an integer power of 2.
"""
return all([
2**floor(log2(dim)) == dim
for dim in flatten(dims)
])
def _super_to_superpauli(q_oper):
"""
Converts a superoperator in the column-stacking basis to
the Pauli basis (assuming qubit dimensions).
This is an internal function, as QuTiP does not currently have
a way to mark that superoperators are represented in the Pauli
basis as opposed to the column-stacking basis; a Pauli-basis
``type='super'`` would thus break other conversion functions.
"""
# Ensure we start with a column-stacking-basis superoperator.
sqobj = to_super(q_oper)
if not _isqubitdims(sqobj.dims):
raise ValueError("Pauli basis is only defined for qubits.")
nq = int(log2(sqobj.shape[0]) / 2)
B = _pauli_basis(nq) / sqrt(2**nq)
# To do this, we have to hack a bit and force the dims to match,
# since the _pauli_basis function makes different assumptions
# about indices than we need here.
B.dims = sqobj.dims
return (B.dag() * sqobj * B)
[docs]def super_to_choi(q_oper):
# TODO: deprecate and make private in favor of to_choi,
# which looks at Qobj.type to determine the right conversion function.
"""
Takes a superoperator to a Choi matrix
TODO: Sanitize input, incorporate as method on Qobj if type=='super'
"""
q_oper = _super_tofrom_choi(q_oper)
q_oper.superrep = 'choi'
return q_oper
[docs]def choi_to_super(q_oper):
# TODO: deprecate and make private in favor of to_super,
# which looks at Qobj.type to determine the right conversion function.
"""
Takes a Choi matrix to a superoperator
TODO: Sanitize input, Abstract-ify application of channels to states
"""
q_oper = super_to_choi(q_oper)
q_oper.superrep = 'super'
return q_oper
[docs]def choi_to_kraus(q_oper, tol=1e-9):
"""
Takes a Choi matrix and returns a list of Kraus operators.
TODO: Create a new class structure for quantum channels, perhaps as a
strict sub-class of Qobj.
"""
vals, vecs = eig(q_oper.full())
vecs = [array(_) for _ in zip(*vecs)]
shape = [np.prod(q_oper.dims[0][i]) for i in range(2)][::-1]
return [Qobj(inpt=sqrt(val)*vec2mat(vec, shape=shape),
dims=q_oper.dims[0][::-1])
for val, vec in zip(vals, vecs) if abs(val) >= tol]
[docs]def kraus_to_choi(kraus_list):
"""
Takes a list of Kraus operators and returns the Choi matrix for the channel
represented by the Kraus operators in `kraus_list`
"""
kraus_mat_list = list(map(lambda x: x.data.toarray(), kraus_list))
op_rng = range(kraus_mat_list[0].shape[0])
choi_blocks = array([[sum([
np.outer(op[:, c_ix],
np.transpose(np.conjugate(op))[r_ix, :])
for op in kraus_mat_list])
for r_ix in op_rng]
for c_ix in op_rng])
return Qobj(inpt=hstack(hstack(choi_blocks)),
dims=[kraus_list[0].dims[::-1], kraus_list[0].dims[::-1]],
type='super', superrep='choi')
[docs]def kraus_to_super(kraus_list):
"""
Converts a list of Kraus operators and returns a super operator.
"""
return choi_to_super(kraus_to_choi(kraus_list))
def _nq(dims):
dim = np.product(dims[0][0])
nq = int(log2(dim))
if 2 ** nq != dim:
raise ValueError("{} is not an integer power of 2.".format(dim))
return nq
[docs]def choi_to_chi(q_oper):
"""
Converts a Choi matrix to a Chi matrix in the Pauli basis.
NOTE: this is only supported for qubits right now. Need to extend to
Heisenberg-Weyl for other subsystem dimensions.
"""
nq = _nq(q_oper.dims)
B = _pauli_basis(nq)
# Force the basis change to match the dimensions of
# the input.
B.dims = q_oper.dims
B.superrep = 'choi'
return Qobj(B.dag() * q_oper * B, superrep='chi')
[docs]def chi_to_choi(q_oper):
"""
Converts a Chi matrix to a Choi matrix.
NOTE: this is only supported for qubits right now. Need to extend to
Heisenberg-Weyl for other subsystem dimensions.
"""
nq = _nq(q_oper.dims)
B = _pauli_basis(nq)
# Force the basis change to match the dimensions of
# the input.
B.dims = q_oper.dims
# We normally should not multiply objects of different
# superreps, so Qobj warns about that. Here, however, we're actively
# converting between, so the superrep of B is irrelevant.
# To suppress warnings, we pretend that B is also a chi.
B.superrep = 'chi'
# The Chi matrix has tr(chi) == d², so we need to divide out
# by that to get back to the Choi form.
return Qobj((B * q_oper * B.dag()) / q_oper.shape[0], superrep='choi')
def _svd_u_to_kraus(U, S, d, dK, indims, outdims):
"""
Given a partial isometry U and a vector of square-roots of singular values S
obtained from an SVD, produces the Kraus operators represented by U.
Returns
-------
Ks : list of Qobj
Quantum objects represnting each of the Kraus operators.
"""
# We use U * S since S is 1-index, such that this is equivalent to
# U . diag(S), but easier to write down.
Ks = list(map(Qobj, array(U * S).reshape((d, d, dK), order='F').transpose((2, 0, 1))))
for K in Ks:
K.dims = [outdims, indims]
return Ks
def _generalized_kraus(q_oper, thresh=1e-10):
# TODO: document!
# TODO: use this to generalize to_kraus to the case where U != V.
# This is critical for non-CP maps, as appear in (for example)
# diamond norm differences between two CP maps.
if q_oper.type != "super" or q_oper.superrep != "choi":
raise ValueError("Expected a Choi matrix, got a {} (superrep {}).".format(q_oper.type, q_oper.superrep))
# Remember the shape of the underlying space,
# as we'll need this to make Kraus operators later.
dL, dR = map(int, map(sqrt, q_oper.shape))
# Also remember the dims breakout.
out_dims, in_dims = q_oper.dims
out_left, out_right = out_dims
in_left, in_right = in_dims
# Find the SVD.
U, S, V = svd(q_oper.full())
# Truncate away the zero singular values, up to a threshold.
nonzero_idxs = S > thresh
dK = nonzero_idxs.sum()
U = U[:, nonzero_idxs]
S = sqrt(S[nonzero_idxs])
# Since NumPy returns V and not V+, we need to take the dagger
# to get back to quantum info notation for Stinespring pairs.
V = V.conj().T[:, nonzero_idxs]
# Next, we convert each of U and V into Kraus operators.
# Finally, we want the Kraus index to be left-most so that we
# can map over it when making Qobjs.
# FIXME: does not preserve dims!
kU = _svd_u_to_kraus(U, S, dL, dK, out_right, out_left)
kV = _svd_u_to_kraus(V, S, dL, dK, in_right, in_left)
return kU, kV
def choi_to_stinespring(q_oper, thresh=1e-10):
# TODO: document!
kU, kV = _generalized_kraus(q_oper, thresh=thresh)
assert(len(kU) == len(kV))
dK = len(kU)
dL = kU[0].shape[0]
dR = kV[0].shape[1]
# Also remember the dims breakout.
out_dims, in_dims = q_oper.dims
out_left, out_right = out_dims
in_left, in_right = in_dims
A = Qobj(zeros((dK * dL, dL)), dims=[out_left + [dK], out_right + [1]])
B = Qobj(zeros((dK * dR, dR)), dims=[in_left + [dK], in_right + [1]])
for idx_kraus, (KL, KR) in enumerate(zip(kU, kV)):
A += tensor(KL, basis(dK, idx_kraus))
B += tensor(KR, basis(dK, idx_kraus))
# There is no input (right) Kraus index, so strip that off.
del A.dims[1][-1]
del B.dims[1][-1]
return A, B
# PUBLIC CONVERSION FUNCTIONS -------------------------------------------------
# These functions handle superoperator conversions in a way that preserves the
# correctness of Qobj.type, and in a way that automatically branches based on
# the input Qobj.type.
[docs]def to_choi(q_oper):
"""
Converts a Qobj representing a quantum map to the Choi representation,
such that the trace of the returned operator is equal to the dimension
of the system.
Parameters
----------
q_oper : Qobj
Superoperator to be converted to Choi representation. If
``q_oper`` is ``type="oper"``, then it is taken to act by conjugation,
such that ``to_choi(A) == to_choi(sprepost(A, A.dag()))``.
Returns
-------
choi : Qobj
A quantum object representing the same map as ``q_oper``, such that
``choi.superrep == "choi"``.
Raises
------
TypeError: if the given quantum object is not a map, or cannot be converted
to Choi representation.
"""
if q_oper.type == 'super':
if q_oper.superrep == 'choi':
return q_oper
if q_oper.superrep == 'super':
return super_to_choi(q_oper)
if q_oper.superrep == 'chi':
return chi_to_choi(q_oper)
else:
raise TypeError(q_oper.superrep)
elif q_oper.type == 'oper':
return super_to_choi(sprepost(q_oper, q_oper.dag()))
else:
raise TypeError(
"Conversion of Qobj with type = {0.type} "
"and superrep = {0.choi} to Choi not supported.".format(q_oper)
)
[docs]def to_chi(q_oper):
"""
Converts a Qobj representing a quantum map to a representation as a chi
(process) matrix in the Pauli basis, such that the trace of the returned
operator is equal to the dimension of the system.
Parameters
----------
q_oper : Qobj
Superoperator to be converted to Chi representation. If
``q_oper`` is ``type="oper"``, then it is taken to act by conjugation,
such that ``to_chi(A) == to_chi(sprepost(A, A.dag()))``.
Returns
-------
chi : Qobj
A quantum object representing the same map as ``q_oper``, such that
``chi.superrep == "chi"``.
Raises
------
TypeError: if the given quantum object is not a map, or cannot be converted
to Chi representation.
"""
if q_oper.type == 'super':
# Case 1: Already done.
if q_oper.superrep == 'chi':
return q_oper
# Case 2: Can directly convert.
elif q_oper.superrep == 'choi':
return choi_to_chi(q_oper)
# Case 3: Need to go through Choi.
elif q_oper.superrep == 'super':
return to_chi(to_choi(q_oper))
else:
raise TypeError(q_oper.superrep)
elif q_oper.type == 'oper':
return to_chi(sprepost(q_oper, q_oper.dag()))
else:
raise TypeError(
"Conversion of Qobj with type = {0.type} "
"and superrep = {0.choi} to Choi not supported.".format(q_oper)
)
[docs]def to_super(q_oper):
"""
Converts a Qobj representing a quantum map to the supermatrix (Liouville)
representation.
Parameters
----------
q_oper : Qobj
Superoperator to be converted to supermatrix representation. If
``q_oper`` is ``type="oper"``, then it is taken to act by conjugation,
such that ``to_super(A) == sprepost(A, A.dag())``.
Returns
-------
superop : Qobj
A quantum object representing the same map as ``q_oper``, such that
``superop.superrep == "super"``.
Raises
------
TypeError
If the given quantum object is not a map, or cannot be converted
to supermatrix representation.
"""
if q_oper.type == 'super':
# Case 1: Already done.
if q_oper.superrep == "super":
return q_oper
# Case 2: Can directly convert.
elif q_oper.superrep == 'choi':
return choi_to_super(q_oper)
# Case 3: Need to go through Choi.
elif q_oper.superrep == 'chi':
return to_super(to_choi(q_oper))
# Case 4: Something went wrong.
else:
raise ValueError(
"Unrecognized superrep '{}'.".format(q_oper.superrep))
elif q_oper.type == 'oper': # Assume unitary
return sprepost(q_oper, q_oper.dag())
else:
raise TypeError(
"Conversion of Qobj with type = {0.type} "
"and superrep = {0.superrep} to supermatrix not "
"supported.".format(q_oper)
)
[docs]def to_kraus(q_oper, tol=1e-9):
"""
Converts a Qobj representing a quantum map to a list of quantum objects,
each representing an operator in the Kraus decomposition of the given map.
Parameters
----------
q_oper : Qobj
Superoperator to be converted to Kraus representation. If
``q_oper`` is ``type="oper"``, then it is taken to act by conjugation,
such that ``to_kraus(A) == to_kraus(sprepost(A, A.dag())) == [A]``.
tol : Float
Optional threshold parameter for eigenvalues/Kraus ops to be discarded.
The default is to=1e-9.
Returns
-------
kraus_ops : list of Qobj
A list of quantum objects, each representing a Kraus operator in the
decomposition of ``q_oper``.
Raises
------
TypeError: if the given quantum object is not a map, or cannot be
decomposed into Kraus operators.
"""
if q_oper.type == 'super':
if q_oper.superrep in ("super", "chi"):
return to_kraus(to_choi(q_oper), tol)
elif q_oper.superrep == 'choi':
return choi_to_kraus(q_oper, tol)
elif q_oper.type == 'oper': # Assume unitary
return [q_oper]
else:
raise TypeError(
"Conversion of Qobj with type = {0.type} "
"and superrep = {0.superrep} to Kraus decomposition not "
"supported.".format(q_oper)
)
[docs]def to_stinespring(q_oper):
r"""
Converts a Qobj representing a quantum map $\Lambda$ to a pair of partial isometries
$A$ and $B$ such that $\Lambda(X) = \Tr_2(A X B^\dagger)$ for all inputs $X$, where
the partial trace is taken over a a new index on the output dimensions of $A$ and $B$.
For completely positive inputs, $A$ will always equal $B$ up to precision errors.
Parameters
----------
q_oper : Qobj
Superoperator to be converted to a Stinespring pair.
Returns
-------
A, B : Qobj
Quantum objects representing each of the Stinespring matrices for the input Qobj.
"""
return choi_to_stinespring(to_choi(q_oper))


Hello everybody,
and I'm sorry for creating a topic every time but I can't see where else I should start this conversation. Also thanks very much for the support until now :)
I started trying to understand MartinR's PLL sketch in order to monitor voltage and a single-phase voltage. I am trying to clean the code out of the diversion part and try to make sense with the rest of it.
I have some questions until now :
1) What if I want to use the internal reference voltage as used in Emonlib which means calculating V_RATIO every time as follows:
#define ADC_COUNTS (1<<ADC_BITS)
and then inside calculateVIPF put the following code:
int SUPPLYVOLTAGE = readVcc();
double V_RATIO = VCAL *((SUPPLYVOLTAGE/1000.0) / (ADC_COUNTS));
double I1_RATIO = I1CAL *((SUPPLYVOLTAGE/1000.0) / (ADC_COUNTS));
2) How to I determine I1LEAD?
3) VOLTSPIN 2 means A2 eh?
3)I can't print my sampleV inside the interrupt so I can't really check my results. Where should I check it? It doesn't print even inside updatePLL.
4) I made sendResults a printResults function and for Vrms,Irms,frequency I get
nan nan PLL is unlocked
nan nan PLL is unlocked
Any ideas?(Ok. If I get to print anything I could check it myself too)
I haven't changed anything inside the code except for the PINS and the diversion part. Maybe that's also the problem...
Thanks anyway for the feedback :)
Re: Questions on MartinR's PLL sketch
Have you read the description of how the sketch works?
If you do NOT want energy diversion, and simply want to understand how the PLL works, then look at http://openenergymonitor.org/emon/node/1377
Re: Questions on MartinR's PLL sketch
yes step by step while reading this very nice blog but i still don't really feel very comfortable with all this.
For example this printing thing, I can't debug without printing :(
But thanks thanks thanks for the link it seems i could have saved some time...
[Do not double post. If your post is held for moderation, please wait for it to be attended to.]
Re: Questions on MartinR's PLL sketch
*and i also don't understand what the code is doing here:
result = ADCL;
result |= ADCH<<8;
(...)
sampleV = result;
Re: Questions on MartinR's PLL sketch
Those are absolutely standard C language operators. Any moderately good tutorial on the C language will explain. Type "C operators" into your favourite search engine.
Re: Questions on MartinR's PLL sketch
The ADC result is a 10-bit number but the interface to the ADC is through 8-bit registers, so you need to extract the low byte (ADCL) and the high byte (ADCH) and get them into the right place in your 16-bit variable, which is all the above code snippet is doing.
Alternatively, you could let the compiler do the work for you and simply use "ADC" which is the symbol used to indicate the 16-bit result. You can see in the code snippets below, this results in significantly less machine code.
while
Re: Questions on MartinR's PLL sketch
The ADC result is a 10-bit number but the interface to the ADC is through 8-bit registers, so you need to extract the low byte (ADCL) and the high byte (ADCH) and get them into the right place in your 16-bit variable, which is all the above code snippet is doing.
dBC,
Thanks for the explanation and the comparison. As an Electronics Tech, my specialty is hardware, so my C skills are not much more than beginner. Your answer helped me a lot.
Thanks again,
Bill
Re: Questions on MartinR's PLL sketch
dBC,
oh thaaaank you very much !
I both got it and changed it :)
Robin,
thanks too, i promise i have worked a lot till now (i haven't done anything with c for the last 5 years so it's pretty chinese at this level)
Anyways I still get :
nan nan PLL is unlocked
The code that you gave me is working and the main difference I found was that part because it reads the result not with the ADC but with analogRead.
So ... still trying to find what is the useful thing I accidentally erased :)
Re: Questions on MartinR's PLL sketch
Surely less code is better? Is there any reason by reading the high and low values is preferred over the single read? It is like this for older processors as the assembler instructions that do the actual read, IMO, look the same.
Re: Questions on MartinR's PLL sketch
As I understand it, "analogRead" does much more than just transfer the values from the registers, that is unnecessary in this case. Speed is of the essence, which is why Martin did it the way he did. Maybe he didn't realise the 16-bit instruction existed.
Re: Questions on MartinR's PLL sketch
analogRead() programs up the MUX, initiates a conversion, waits for the conversion to finish (typically about 110usecs with the most common clock settings), then fetches and returns the result. It offers a completely synchronous interface to the ADC which is simple to understand but incredibly wasteful of clock cycles. The CPU does nothing useful for the entire duration of the conversion.
The snippet of code above merely fetches the result of a previously completed conversion. It takes just a handful of instructions, and an even smaller handful if you use the 16-bit symbol rather than the two 8-bit symbols.
So it's not just that analogRead() does unnecessary stuff, it does destructive stuff if the results of a previous conversion were sitting there waiting to be fetched. By the time analogRead() returns, the results of the previous conversion will be lost forever and replaced by a whole new conversion.
Re: Questions on MartinR's PLL sketch
I think the whole point, which ioannamirto might have missed, is that towards the end of the Interrupt Service Routine, it sets the next input and starts the next conversion, then returns control to the main loop, which continues doing the things it does. When the conversion is complete 110 μs later, an interrupt is triggered, the main loop stops where it happens to be, and the ISR takes over, collects the data from the just-completed conversion and puts it where the main loop can reach it, then sets the next input etc.
[Edit: I have just checked - this is in Part 4 of the article about Martin's controller.]
Doing analogRead means that 110 μs of processing time is lost for each reading, and it is not possible to read samples continuously and send data by radio etc.
Re: Questions on MartinR's PLL sketch
I agree with your comments Robert. I did not know a single read existed. The timing is controlled by the ISR.
I have seen the common pattern of reading high and low in several sketches perhaps for the same reason. If there are no negative effects for a single read then surely this is better use of code.
But I am still a novice when it comes to Arduino.


This is the first version of OpenStage SDK, developed in September 2011. The OpenStage SDK is a set of Java classes that represent XML objects specified in "OpenStage 60/80 - XML Applications, Developer's Guide", as of September 2011. Since the OpenStage platform is under development, the SDK itself may become outdated in the future. Please obtain the latest available SDK before you start developing applications.
This is a Software Development Kit, which aims to speed up the process of developing XML applications for OpenStage 60/80 and compliant devices. The SDK includes Java representations of all objects that are defined in the official documentation. It also provides easy-to-use push request constructor and sender.
Copyright 2011 Mateusz Bysiek<EMAIL_ADDRESS>http://mbdev.pl/ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


John Doe OWNER August 30, 2016 Edited • Visible to Owners Only
What do you guys think of this? Should I Stay or should I go to wonderland?
Reply • Edit • Like


Education:
Masters
International Technological University, San Jose, CA, USA
Masters in Software Engineering
Bachelor
Gujarat Technological University, Bharuch, Gujarat, India
Bachelor in Computer Engineering
Diploma
The Maharaja Sayajirao University of Baroda, Baroda, Gujarat, India
Diploma in Computer Engineering
Work Experience
JFrog
- Responsible for developing Tools and Script for DevOps.
- User plugin Development using Groovy, Ruby.
- Enable privateBower Setup for users.
- Developed Build Release and Promotion Pipeline using Jenkins/Bamboo and Artifactory
for CI/CD.
- Build and release management by setting up Bamboo and Artifactory for CI/CD
- Developed plugin for Bitbucket Cloud using Atlassian Connect
- Provided integrations for community solutions like: Homebrew, Helm, Puppet, Travis
CI, CircleCI, Terraform, AWS CloudFormation
Zephyr
- Responsible for developing Tools and Script for DevOps.
- Build and release management by setting up Bamboo for CI/CD.
- Development of Virtual Environment for Production and QA using Docker.
- Auto builds Configuration using Grunt Script and NPM dependencies.
- Used Test-Driven Development with SCRUM Agile methodology.
- Implemented Zabbix-based monitoring for the whole corporate heterogeneous IT
infrastructure (Unix, Linux, Windows servers / Databases).
- Implemented centralized log processing using LogStash, Kibana and Elasticsearch.
- Monitored developed applications and fixed bugs.
- Worked on setting and monitoring Cluster of RIAK, Elasticsearch, Hazelcast.
Rahi System
- Participate in requirement gathering, system business analysis for proposed
software.
- Collaborate with other departments to better define requirements and implementation
of software features.
- Develop new software features and functionality in cooperation with a team.
- Implement software defect fixes in cooperation with a team.
- Troubleshoot software performance issues and investigate defect report.
- Working on development of IT Analytics Product.
- Architect the website in MVC pattern using Apache Struts 2.0 Technology.
- Worked with JSON for data exchange between client and server.
- Defined and developed the application’s presentation layer using HTML5, CSS3,
JavaScript and jQuery Scripting.
- Assist with all aspects of a project lifecycle.
- Used Test-Driven Development with SCRUM Agile methodology.
- Code and develop features for Network and Hardware Utilization on Client-side.
- Implement features on Server-side for different user profile features.
International Technological University
- Record all lecture of all subjects.
- Upload all videos to university’s server.
- Manage and upload all lecture Videos to website for student access.
- Convert files to suitable formats.
- Handle all operations on Mac platform.


#include <PxBroadPhaseExt.h>
Static Public Member Functions | |
| static PxU32 | createRegionsFromWorldBounds (PxBounds3 *regions, const PxBounds3 &globalBounds, PxU32 nbSubdiv, PxU32 upAxis=1) |
| Creates regions for PxSceneDesc, from a global box. More... | |
|
static |
Creates regions for PxSceneDesc, from a global box.
This helper simply subdivides the given global box into a 2D grid of smaller boxes. Each one of those smaller boxes is a region of interest for the broadphase. There are nbSubdiv*nbSubdiv regions in the 2D grid. The function does not subdivide along the given up axis.
This is the simplest setup one can use with PxBroadPhaseType::eMBP. A more sophisticated setup would try to cover the game world with a non-uniform set of regions (i.e. not just a grid).
| [out] | regions | Regions computed from the input global box |
| [in] | globalBounds | World-space box covering the game world |
| [in] | nbSubdiv | Grid subdivision level. The function will create nbSubdiv*nbSubdiv regions. |
| [in] | upAxis | Up axis (0 for X, 1 for Y, 2 for Z). |


A good idea to create a proper random function to use for all random integer purposes.
This JavaScript function always returns a random number between min (included) and max (excluded):
Every time you click the button, getRndInteger(min, max) returns a random number between 0 (included) and 10 (excluded):
Every time you click the button, getRndInteger(min, max) returns a random number between 1 and 100 (both included):


{% extends "base.html" %} {% block title %}Login Required{% endblock %} {% block heading %}Login Required{% endblock %} {% block content %}
You will need to log in first before you can view your Globus Auth account information.


BETA This is a new service – your feedback will help us to improve it. Please get in touch (opens in new tab).
Please choose a version


Video player with search (client-side)
Able Player can search a video's caption or subtitle files, with variables defined in data-search-div, data-search, and data-search-lang attributes on the media element. See the server-side search demo for more details about each of these attributes.
The current demo shows how this same functionality can be implemented in a client-side application using JQuery. In this context, the only required attribute of the above three is data-search-div, which specifies the id of a container element in which to write the search results. Otherwise, Able Player is initiated as a variable, which enables us to assign values directly to Able Player's search-related variables based on user input, then call Able Player's showSearchResults() function to display the results. See the source code for details.
Also, in this example, data-include-transcript is set to "false", since there isn't room on this page for both search results and a transcript. A better design would accommodate both features.
Enter a search term below. (hint: "web mouse" is a good choice in English; or "web clicladores idénticos" in Español).


U.S. extends license for businesses to work with Huawei by 90 days
(UPDATED) Huawei says the extension does nothing to alter the company's view that Washington has treated it unfairly, and continues to call for its removal from a foreign technology blacklist
by Agence France-PresseSubscribe
Email Address
Newsletters
- Glenda Gloria's Take this Tuesday
- Huddle by Miriam Grace Go
- The Newsbreak Agenda by Chay Hofileña
- Sometimes, all you need is video by Lilibeth Frondoso


{% extends "main.html" %} {% block content %} {% include "header.html" %} Delete Category ({{category}}) Are you sure you want to delete? Delete {% endblock %}
Are you sure you want to delete?


| DOSE: T+ 0:00 |
|
oral |
Pharms - Lithium |
(daily) |
| T+ 0:00 |
|
oral |
Pharmaceuticals |
(daily) |
| T+ 0:00 |
2.5 hits |
oral |
LSD |
(blotter / tab) |
| T+ 0:30 |
1 bowl |
smoked |
Cannabis |
(plant material) |
I had come across a bit of acid in my hometown and my birthday was a few months away so I snatched some before it was gone about two months prior. I had tried it a few times.... maybe 10 or so trips within a month and a half or so. Maybe a bit excessive looking back on it. Anyway, my birthday came and went and I decided to hang with a friend the weekend after my birthday.
Me and him were tripping this fine day in April and my fiance decided not to. It was a beautiful day out and we decided to start indoors and go outside once things got 'colorful'. I took 2.5 hits of blotter, and he had 2 hits.
My medications include lithium and methimazole which is a Thyroid pill for hyperthyroidism. I already hallucinate and hear things due to my mental illness which is either Post Traumatic Stress Disorder or Schizoaffective Disorder. However when I trip I'm able to escape the mental prison of voices that I have for at least a day which is great relief to me. I should also mention that I've had many Research Chemical experiences and I think that played into today.
Back to the trip, I had taken as many as 8 of this batch with wonderful results about a month prior. I took a month break from tripping to have no tolerance for my birthday experience. I've always wanted a life changing experience, but on my own terms and I now know why these experiences come when I least expect them because they change me.
Ok, 30 min. to an hour is when it kicked in good. Visuals were good, and we had started toking on a bowl 30 min. after taking the LSD. At the one hour mark things had started to get crazy, especially after the bowl. I wanted to go outside so I got up to go get my shoes. As I was walking I thought I had stood up to fast because all of a sudden everything turned white and sound was so distorted and slowed down I thought I was passing out. So my first instinct was to drop to the ground to minimize injury. Every time I stood up past this point, that is what happened.
T+1:15:
I was lying out on the floor. I couldn't get up or move. Something was wrong. I could no longer see anyone or anything. I could not hear anyone or anything. I was literally gone. This must've been a level 6!!! Quickly things went from bad, to really really bad. I started to lose consciousness, which didn't make sense. I felt if I lost consciousness I was then dead because I can't overdose off of 2.5 hits, besides I tried 8 about a month prior. The two people with me didn't know what to do. I told my girl to call an ambulance because losing consciousness didn't seem right to me and if I was going to be bad off I wanted to be in the hospital where I felt safe and my family could be called to see me in the event of death.
I haven't mentioned the visuals because that's all anybody ever talks about. The visuals were more intense than salvia, I was literally in another world, seeing, touching, feeling another world. I mostly saw me and my fiancÚ a lot, with little pot leafs floating in the background this was my picture of life and next was death.
At this point I couldn't talk. All I could do was spit out a bunch of jargon that made no sense. I would cut to words in half and combine them to make new words. The paramedics couldn't get any necessary info out of me other than, 'How many did you take?' I said 2 or 3 and they flat out called me a liar and said 'You mean 6,7,8, 10!?! You didn't take 2 to get like this pal!!!'
They couldn't believe what they were seeing. At this point I thought I was on the edge of death, I kept going in and out of consciousness and it effected my trip each time. I lost track of time because I couldn't see the world around me. And then in the hospital I lay there, in my own world. And I heard the Dr. say, 'It's too late, we've lost him.' They start disconnecting the lines attached to me. I begin to cry out my last words to my family and my girl, as I hold her hand... but I can't see anything that's really going on or hear anything that's going on. And then I saw death, it was total and complete nothingness. No conscious thought, no feeling, no nothing. And then I proceeded to stop breathing as I went through death.
During this time where I stopped breathing, it was brief, I made it to heaven and God gave me requirements in order to get my life back. I was denied and then I was sent back to my body which was then discarded in a dump or where ever they keep masses of dead people. And that's where any final thought dissipated.
At this point my fiancÚ must've realized I wasn't breathing, I woke up to 'You're going to make it!' This came out of the nurse holding my left hand and my girl was on my right. I woke up to find all kinds of lines attached to me, and monitoring equipment. I asked how long I was gone for..... my ER report showed I had been there for five and a half hours plus the half hour at home made for a 6 hour experience on the deep end.
It was a complete life altering experience, I'm 25 years old and the thought of never having kids really sucked. I saw everything I'd miss out on. I saw my funeral, and everyone who attended. I've never experienced anything this intense and I've eaten 16 hits before. When I was 18-19 years old, I liked LSD over everything and it was abundant.
The one reason I sent this in was because me and another friend had some bad times... his on ecstasy. But we both had one thing in common, we each used 2C's frequently for a 6 month period prior to both of us landing in the hospital. I almost didn't come back, he almost died from bleeding in the brain. I don't think the LSD was the main factor in such a profound trip, I think the 2C's set the stage, mostly 2CI.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


One of the two-dimensional shapes you can get by cutting a slice through a cone; i.e. ellipse, parabola, hyperbola. These shapes are also the graphs of quadratic equations in two variables.
The general equation for these curves is ax2 + 2hxy + by2 + 2gx + 2fy + c = 0. The type of curve can be determined by computing the two quantities Δ = abc + 2fgh − af2 − bg2 − ch2 and h2 − ab:
| Δ ≠ 0 | Δ = 0 | |
| h2 − ab < 0 | Ellipse | Point |
| h2 − ab = 0 | Parabola | Pair of parallel or coincident lines, or an imaginary locus |
| h2 − ab > 0 | Hyperbola | Pair of intersecting lines |


Query Converter
ER modelling
|
BCNF analysis
|
3NF and 4NF analysis
|
Relational Algebra
|
SQL Interpreter
|
XML & XPath
XML validation and XPath queries
1. Enter the XML document below, or
,
or upload a file:
2.
3. Enter an XPath query below (example:
/QConvData//@name
):
4.


{% extends 'base.html' %} {% block header %} {% endblock %} {% block content %}
Resume Review
Something was wrong with your file. Please try again.


Nyzo version 611 (commit on GitHub) adds further improvements and tests for the CycleDigest class.
This version does not affect any run modes. It contains foundational work for future functional changes.
This version further develops the CycleDigest class that was introduced in version 596 and previously updated in versions 598 and 610. This version adds a flag to indicate whether a CycleDigest has enough history to validate all proof-of-diversity rules, and it reduces the block history required to calculate a CycleDigest by a full cycle. Testing is also expanded.
In CycleDigest, the constant requiredCyclesForCompleteness was added. Cycle digests need four full cycles to allow the proof-of-diversity rules to be evaluated.
A new complete field was added to indicate whether the object has the full information required of a CycleDigest. Ultimately, we would like to perform another blockchain update that stores the hash of the digest at the frozen edge, which would ensure that a complete CycleDigest is always available at the frozen edge, eliminating the need for this flag.
The CycleDigest constructor is now public instead of private. Currently, CycleDigestTest is the only other class creating CycleDigest objects, but plans are in place for a CycleDigestManager class that will likely also need to create instances of CycleDigest.
The calculateCycleStartIndices() method changed to calculateCycleStartIndicesAndCompleteness(). This method and the calculateCycleLengths() method now both return void, and the calculated values are stored in the object fields within these methods.
Instead of using the array length when removing excess identifiers, the requiredCyclesForCompleteness constant is now used to improve readability.
To avoid spamming the console, the newVerifierStates are no longer printed within the constructor, and the continuity state now considers the new complete flag.
The print() method no longer accepts the new-verifier states as an argument, instead using the fields available to the instance method. The old method of printing cycles is used for digests with up to 20 heights.
A condensed version is now displayed for digests handling longer cycles.
A convenience method of isNewVerifier() was added for parity with the CycleInformation class.
A suggestedBlockHeight is now passed to the digestForNextBlock() method. This is used to allow a CycleDigest to be built starting an any height, without the onerous requirement of starting at the Genesis block.
The renamed calculateCycleStartIndicesAndCompleteness() method now uses the requiredCyclesForCompletness constant to define the cycleStartIndices array length. This array is now one element shorter than it was previously. Results are stored in the appropriate object fields, and the cycle count and completeness are displayed for debugging purposes.
In the calculateCycleLengths() method, the cycleLengths array is now the same size as the cycleStartIndices array. The cycleLengths array did not change size. This is an adjustment due to the removal of an unnecessary element from the cycleStartIndices array.
A reference to the cycleLengths array is now stored in the class field in this method instead of being returned. This follows the design of the calculateCycleStartIndicesAndCompleteness method.
The isComplete() accessor method was added.
A method for reading a CycleDigest from a file was added. To support this method, the fileForHeight() method standardizes locations of CycleDigest files.
The CycleDigest.toString() method now includes the completeness and length of the identifier list.
At the beginning of CycleDigestTest.main(), the testHardCoded() method is now invoked.
The block height is now passed to the digestForNextBlock() method, although the value is redundant and unused when the cycle digest provided to the method is non-null.
Finally, completeness is checked on all digests created from the block files.
The CycleDigestTest.testHardCoded() method checks some simple digests to examine specific behaviors of the CycleDigest class that might not be captured in real scenarios on the Nyzo blockchain.
The CycleDigestTest.testDigest() method checks a single digest produced from a character string. Each character in a string represents a verifier identifier, and all of the expected parameters of the cycle digest are specified and checked against computed parameters.
The CycleDigestTest.check() methods now have color coding to provide more obvious feedback on failed tests. An overload for comparing two Objects was added.


Work in progress...
While this feature is under construction, please use BART's own handy trip planner tool.


If you're using the Weka machine learning toolkit, you'll agree that managing datasets in the ARFF format is not easy. Adding, removing or modifying instances is easy, but doing the same on attributes is almost impossible without writing a dedicated script. The problem is that the @DATA
section of an ARFF file can be edited under a spreadsheet software, but not the header (attributes declaration).
A solution is to handle a fully tabular representation of these same datasets. Using a spreadsheet software (like Excel) you can merge, split, edit such tables, or generate them from your own software pipeline. Tab2ARFF will convert this tabular dataset into a valid ARFF file that Weka can handle. Additionnal filtering capabilities are also provided.
--report
optionTab2ARFF is a Python script designed to be used on the command line. The only requirement is to have a recent version of a Python intepreter installed on your computer.
The input file is a tabular representation of a Weka dataset. Each column is an attribute, each line an instance. The first line must contains the name of the attributes, and the second their type -- either NUMERIC
, DATE
, STRING
or a nominal (comma-separated values between {
and }
). All other lines contain values for each instance:
Name Age Sex Soccer player NUMERIC { m, f } { yes, no } Pedro 23 m yes Bianca 24 f no Hector ? m yes Petra f yes
Notes:
?
is considered as a missing valueThe tab-delimited dataset is read either on the standard input or from a file (-i
option). The ARFF-formated output is written either on the standard output or in a file (-o
option).
Typing tab2arff -i dataset.txt -o dataset.arff
(or tab2arff < dataset.txt > dataset.arff
) will produce:
% Generated Jul, 20 2006 @RELATION "None" @ATTRIBUTE Age NUMERIC @ATTRIBUTE Sex { m, f } @ATTRIBUTE "Soccer player" { yes, no } @DATA 23, m, yes 24, f, no ?, m, yes ?, f, yes
Notes:
Additionally, information about the size of the dataset are displayed on the standard error:
:: Reading from standard input 2+1 attributes, 4 instances (0 ignored, 4 total)
Meaning that the resulting ARFF file contains 2 attributes and 1 class (the class, as determined by the ARFF format, is by default the last attribute declared), 4 instances, none of them having been filtered. These values can be stored in an external text file using the --report
option (see below).
The options of Tab2ARFF are accessible by typing tab2arff --help
on the command line:
Usage: tab2arff [options] Options: --version show program's version number and exit -h, --help show this help message and exit options for the input: -i INPUT_FILENAME, --input=INPUT_FILENAME Tab-delimited input file containing the dataset to convert to an ARFF file. The first line must contains the name of the attributes, the second one their type (or empty character for non-eligible attributes), then the data (default: reading on stdin) --indices=ATTRIBUTE_INDICES Comma-separated list of attributes to include, designated by their indices in the input file (starting from 1 for the first attribute). A range of attributes can be provided, as well as name for attributes' groups between parenthesis. Example: --indices "(My attributes)1-10,(My class)11". If neither '--indices' or '--names' is provided, all the eligible attributes from the input are included in the ARFF file. --names=ATTRIBUTE_NAMES Filename containing a list of the attributes to include, designated by their exact name in the input (case sensitive, one name per line). A name for attributes' groups can be provided by inserting a line with this name preceded by a ':' character options for the output: -l, --list-attributes Display a list of the eligible attributes and their indices, then quit -o OUTPUT_FILENAME, --output=OUTPUT_FILENAME Output ARFF file (default: stdout) --relation-name=RELATION_NAME Name of the dataset (default: input filename or None) -A, --allow-instances-without-attributes Allow instances to have all their attributes missing (by default, these instances are automatically filtered -C, --allow-instances-without-class Allow instances to have their class missing (by default, these instances are automatically filtered -R, --remove-empty-attributes If set, all attribute having no value in all the instances is removed. --report=REPORT_FILENAME Write in a file the final dimensions of the dataset (number of instances and attributes)
The first important feature of Tab2ARFF is to let you select any subset of attributes you want to make your ARFF file. This let you the possibility, if you have several classes for example, to create a unique tabular dataset (easy to manage) and be able to create several distinct ARFF files, just changing the attribute designated to be the class.
You have two ways to give the list of attributes to include (if you precise nothing, all the attributes are included in the order they have in the tabular dataset):
--names
to read this file (empty lines or lines starting by a '#' are ignored). You have the possibility to add 'section' names by typing a name prefixed by ':'. This can be useful if you have numerous attributes and want to somehow visually group them in the final ARFF file. An example of such a list of attributes (e.g., stored in 'list.txt') would be:
:Attributes Age Sex :Class Soccer playerTyping
tab2arff --names list.txt < dataset.txt > dataset.arff
you'll then obtain:
% Generated Jul, 20 2006 @RELATION "None" % Attributes @ATTRIBUTE Age NUMERIC @ATTRIBUTE Sex { m, f } % Class @ATTRIBUTE "Soccer player" { yes, no } @DATA 23, m, yes 24, f, no ?, m, yes ?, f, yesWell, this example is not very striking (we're basically selecting the very same set of attributes than the one by default), but you got the idea.
Age
and Sex
have the indices 2 and 3, respectively. You can use these values to select attributes as well, using the --indices
option. In order to obtain the ARFF output of the 'Simple usage' section above, you then could have typed tab2arff --indices 2,3,4 < dataset.txt > dataset.arff
, and obtained the same result. As previously, you can add section names, by using parenthesis. This would give, as in the last example, tab2arff --indices "(Attributes)2,3,(Class)4" ...
.tab2arff --indices 2-4 ...
Name
here) have a column indice itself. That's why Age
, which is the first attribute in the resulting ARFF file, have an indice of 2 and not of 1, being declared after Name
in the tabular dataset. Using 1 as an indice will result in an error, as this field is not a valid attribute:
~ % tab2arff --indices 1 < dataset.txt :: Reading from standard input Error: invalid column index #1If you want a list of all the valid attributes in a given tabular dataset, along with their indices, you can use the
--list-attributes
option:
~ % tab2arff --list-attributes < dataset.txt :: Reading from standard input # Column index Name Type 2 Age NUMERIC 3 Sex { m, f } 4 "Soccer player" { yes, no }
The second main feature of Tab2ARFF is to allow you to filter for missing informations. There is basically three types; the filtering can be switched on or off by using the corresponding options:
--allow-instances-without-class
option.--allow-instances-without-attributes
.--remove-empty-attributes
option.Example Consider the following dataset:
Dummy Attribute1 Attribute2 Attribute3 Class NUMERIC NUMERIC NUMERIC NUMERIC a 1 ? 2 ? b 2 ? 3 c ? ? ? 4 d ? ? ? e ? ? ? 5 f 6 ? 7 8
Launching Tab2ARFF with default filtering options will result into the following output:
% Generated Jul, 20 2006 @RELATION "None" @ATTRIBUTE Attribute1 NUMERIC @ATTRIBUTE Attribute2 NUMERIC @ATTRIBUTE Attribute3 NUMERIC @ATTRIBUTE Class NUMERIC @DATA 6, ?, 7, 8
... and the following information:
:: Reading from standard input Skipping instance #1 (no class) data: "a, 1, ?, 2, ?"  Skipping instance #5 (no attributes) data: "e, ?, ?, ?, 5" 3+1 attributes, 1 instances (5 ignored, 6 total)
Here the dataset contains a lot of missing informations, which are detailed: 5 out of 6 instances have been excluded. If you want to force Tab2ARFF to keep instances with no class, but eliminate attributes that have no value for all the instances (here, Attribute2
), then type: tab2arff --allow-instances-without-class --remove-empty-attributes ...
, which will produce:
% Generated Jul, 20 2006 @RELATION "None" @ATTRIBUTE Attribute1 NUMERIC @ATTRIBUTE Attribute3 NUMERIC @ATTRIBUTE Class NUMERIC @DATA 1, 2, ? 2, 3, ? 6, 7, 8... with the associated output:
:: Reading from standard input Removing empty attributes: 1 to remove Attribute2 Skipping instance #3 (no attributes) data: "c, ?, ?, ?, 4" Skipping instance #4 (no attributes) data: "d, ?, ?, ?" Skipping instance #5 (no attributes) data: "e, ?, ?, ?, 5" 2+1 attributes, 3 instances (3 ignored, 6 total)
Enjoy !
Tab2ARFF fit for now all my needs, but they're maybe not yours. You're free to modify this small script for your need. One interesting thing I could do one day if I really need it is to write the opposite tool, able to parse an ARFF file to transform it into a tabular dataset. If somebody is interested, I could write this relatively easily.


Toggle navigation
Home
Contacts
QnA LASM
Intestacy and Premium Tax Credit QnA's
Intestacy in MA
Where does your money go in Massachusetts?
Premium Tax Credit
Do you qualify?
Creator
Student Trying to Get By
John Doe
Developer
Law Student 1
Student
John Doe
Developer


INCC is a general purpose neutron coincidence counting program that runs on personal computers running any Microsoft Windows operating system. It is intended for nondestructive passive and active neutron verification applications. Passive neutron verification techniques include calibration curve, known alpha, known multiplication, add-a-source, multiplicity, curium ratio and truncated multiplicity. Active techniques include calibration curve, multiplicity, collar and active/passive. You can use all of these techniques with INCC. Active multiplicity presently determines the neutron multiplication of a uranium item, but does not determine the uranium mass.
You can verify items using multiple verification techniques at the same time by selecting multiple analysis methods. For example, you might verify plutonium items using the passive calibration curve and the known alpha techniques simultaneously. Collar verifications cannot be combined with other verification techniques. You can group verification measurements by inspection number.
You can use any of the common coincidence electronics packages: the Canberra JSR-11 and JSR-12, the Canberra JSR-14 in either PSR or JSR-12 mode, the Los Alamos MSR4 multiplicity module, the Canberra 2150 multiplicity module (a commercial version of the MSR4), the Los Alamos and Aquila portable shift register (PSR), the Los Alamos intelligent shift register (ISR), the Advanced Multiplicity Shift Register (AMSR) and the Los Alamos dual gated shift register (DGSR). To use the Canberra JSR-14, you must use the Canberra program to set the high voltage mode to “portable”.
All measurement results are stored in both database and text files. You can save and restore the entire database or measurement data, measurement (detector) parameters and calibration parameters for transfer between computers. You can import Stratum Authority and Item Relevant Data files from IFSS, SPAN and NMAX. You can export files for the Operator-Inspector Measurement Database and Logsheet and you can export Performance Monitoring files. You can review, create reports and print any measurement data and results at any time. When the program is started you will be warned if the hard disk is more than 90 percent full. If you see this warning you need to free up some disk space. If the hard disk becomes 95 percent full, measurement data acquisition will be disabled in order to protect the database from becoming corrupted when the hard disk is completely full.
You can develop calibration curves with the INCC program. To do this, collect data from calibration standards and fit the data with the Deming least squares fitting program which can be called by the INCC program. The resulting calibration coefficients are automatically transferred to calibration files and you are ready for verification measurements. You can only use Deming for the passive and active calibration curve, known alpha, and add-a-source analysis methods.
You can plot calibration curves with the calibration and verification measurement data to produce graphical summaries of calibration and verification results.
You can write a summary of verification results or all measurement results, one measurement per line, in comma separated variable format for input to a spreadsheet program such as EXCEL.
Measurement control options are included for quality control tests. They include normalization and precision tests to check the detector efficiency and stability, and raw data tests and outlier tests to check for data consistency.
You can calculate the mass and display results for verification measurement data files imported from Radiation Review. You can also process and display results for background and normalization measurement data files imported from Radiation Review. These files are created from measurements made by Shift Register Collect or Multi-Instrument Collect (MIC) running in unattended mode. The results will remain in the database, and can be reviewed or reanalyzed at any time.
If the mass has previously been calculated using the import function, you can display the results for the verification or normalization measurement corresponding to a peak on a graph in Radiation Review by simply clicking on or near the peak and requesting INCC data display.
Clicking on Tools | Select Another Review Tool will provide the user with the ability to have Radiation Review display the peak corresponding to the most recently displayed INCC verification measurement.


Sara Kingsley
home
about
c.v.
publications
blog
"It
always
seems impossible until it's done."
Nelson Mandela