Transform
TransformTrait ¶
add_position ¶
Add a position or multiple positions to a pre-existing geometry.
add_position
is capable of accepting: - A single tuple for one atom coordinate: (1.0, 2.5)
- A list of tuples: `[(0.0, 1.0), (2.0,1.5), etc.] - A numpy array of shape (N, 2) where N is the number of atoms
You may also intersperse variables anywhere a value may be present.
You can also pass in an optional argument which determines the atom "filling" (whether or not at a specified coordinate an atom should be present).
Usage Example:¶
# single coordinate
>>> reg = start.add_position((0,0))
# you may chain add_position calls
>>> reg_plus_two = reg.add_position([(2,2),(5.0, 2.1)])
# you can add variables anywhere a value may be present
>>> reg_with_var = reg_plus_two.add_position(("x", "y"))
# and specify your atom fillings
>>> reg_with_filling = reg_with_var.add_position([(3.1, 0.0), (4.1, 2.2)],
[True, False])
# alternatively you could use one boolean to specify
# all coordinates should be empty/filled
>>> reg_with_more_filling = reg_with_filling.add_positions([(3.1, 2.9),
(5.2, 2.2)], False)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in src/bloqade/ir/location/transform.py
apply_defect_count ¶
Drop n_defects
atoms from the geometry randomly. Internally this occurs by setting certain sites to have a SiteFilling set to false indicating no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:¶
>>> from bloqade.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_count(2, custom_rng)
# you may also chain apply_defect_count calls
>>> reg.apply_defect_count(2, custom_rng)
# you can also use apply_defect_count on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)]).apply_defect_count(1, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts) .apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in src/bloqade/ir/location/transform.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
apply_defect_density ¶
Drop atoms randomly with defect_probability
probability (range of 0 to 1). Internally this occurs by setting certain sites to have a SiteFilling set to false indicating no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:¶
>>> from bloqade.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_density(0.2, custom_rng)
# you may also chain apply_defect_density calls
>>> reg.apply_defect_count(0.1, custom_rng)
# you can also use apply_defect_density on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)])
.apply_defect_density(0.5, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts).apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in src/bloqade/ir/location/transform.py
scale ¶
Scale the geometry of your atoms.
Usage Example:¶
>>> reg = start.add_position([(0,0), (1,1)])
# atom positions are now (0,0), (2,2)
>>> new_reg = reg.scale(2)
# you may also use scale on pre-defined geometries
>>> from bloqade.atom_arrangement import Chain
# atoms in the chain will now be 2 um apart versus
# the default 1 um
>>> Chain(11).scale(2)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser