136136 @test isempty (b. vectors)
137137 @test isempty (b. lines)
138138 @test isempty (b. arcs)
139+
139140 b = Bloch ()
140141 add_points! (b, hcat ([1.0 , 0.0 , 0.0 ], [0.0 , 1.0 , 0.0 ], [0.0 , 0.0 , 1.0 ]))
141142 add_vectors! (b, [[1 , 1 , 0 ], [0 , 1 , 1 ]])
149150 @test false
150151 @info " Render threw unexpected error" exception= e
151152 end
153+ b. vector_arrowsize = [0.7 , 0.8 , 1.5 ] # 1.5 is the length of arrow head (too long)
154+ @test_throws ArgumentError render (b)
155+
152156 b = Bloch ()
153157 ψ₁ = normalize (basis (2 , 0 ) + basis (2 , 1 ))
154158 ψ₂ = normalize (basis (2 , 0 ) - im * basis (2 , 1 ))
@@ -167,14 +171,20 @@ end
167171 Pauli_Ops = [sigmax (), sigmay (), sigmaz ()]
168172 ψ = rand_ket (2 )
169173 ρ = rand_dm (2 )
174+ states = [ψ, ρ]
170175 x = basis (2 , 0 ) + basis (2 , 1 ) # unnormalized Ket
171176 ρ1 = 0.3 * rand_dm (2 ) + 0.4 * rand_dm (2 ) # unnormalized density operator
172177 ρ2 = Qobj (rand (ComplexF64, 2 , 2 )) # unnormalized and non-Hermitian Operator
173- add_states! (b, [ψ, ρ])
174- @test_logs (:warn ,) (:warn ,) (:warn ,) (:warn ,) add_states! (b, [x, ρ1, ρ2])
178+ add_states! (b, states, kind = :vector )
179+ add_states! (b, states, kind = :point )
180+ @test length (b. vectors) == 2
181+ @test length (b. points) == 1
175182 @test all (expect (Pauli_Ops, ψ) .≈ (b. vectors[1 ]))
176183 @test all (expect (Pauli_Ops, ρ) .≈ (b. vectors[2 ]))
184+ @test all ([b. vectors[j][k] ≈ b. points[1 ][k,j] for j in (1 , 2 ) for k in (1 , 2 , 3 )])
185+ @test_logs (:warn ,) (:warn ,) (:warn ,) (:warn ,) add_states! (b, [x, ρ1, ρ2])
177186 @test length (b. vectors) == 5
187+ @test_throws ArgumentError add_states! (b, states, kind = :wrong )
178188
179189 th = range (0 , 2 π; length = 20 )
180190 xp = cos .(th);
0 commit comments