Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Sources/DiffractoGeometry/EllipseCalibration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ public enum EllipseCalibration {
struct ProgressSpan {
let report: (@Sendable (Double) -> Void)?
let start: Double, end: Double
static let none = ProgressSpan(report: nil, start: 0, end: 1)
func callAsFunction(_ fraction: Double) {
report?(start + (end - start) * min(1, max(0, fraction)))
}
Expand Down
1 change: 0 additions & 1 deletion Sources/DiffractoOrientation/ACOMMetal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
//

import Foundation
import DiffractoCore
#if canImport(Metal)
import Metal
#endif
Expand Down
2 changes: 0 additions & 2 deletions Sources/DiffractoOrientation/PhaseVectorTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

import Foundation
import simd
import DiffractoCore
import DiffractoScattering

// MARK: - Settings

Expand Down
2 changes: 1 addition & 1 deletion Tests/DiffractoCoreTests/CIFImportTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ struct CIFImportTests {

"""

private func refusal(_ cif: String, _ file: StaticString = #filePath, line: UInt = #line) -> CIFImportError? {
private func refusal(_ cif: String) -> CIFImportError? {
do { _ = try CIFImport.read(cif, fileBaseName: "t"); Issue.record("admitted"); return nil }
catch { return error }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// needs no expansion of its own. Exact (a fixed matrix on a fixed cell).
//

import DiffractoKitTestSupport
import Foundation
import Testing
import simd
Expand Down
2 changes: 0 additions & 2 deletions Tests/DiffractoCoreTests/ConventionalCellPinSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,3 @@ func niggliViolations(_ v: [SIMD3<Double>], eps: Double) -> [String] {
func metric(of vectors: [SIMD3<Double>]) -> [[Double]] {
(0..<3).map { i in (0..<3).map { j in dot(vectors[i], vectors[j]) } }
}

func isUnimodularWithPositiveDeterminant(_ p: IntegerMatrix) -> Bool { p.determinant == 1 }
1 change: 0 additions & 1 deletion Tests/DiffractoGeometryTests/EllipseStopRuleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// of the four rings throws `didNotConverge`.
//

import DiffractoKitTestSupport
import Testing
import Foundation
import DiffractoGeometry
Expand Down
1 change: 0 additions & 1 deletion Tests/DiffractoGeometryTests/EllipseTransformTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
// RED UNDER: e = a/b for e = b/a; the axis swap of the returned pair dropped; the inverse's signs; `accepted` letting b <= 0 pass.
//

import DiffractoKitTestSupport
import Testing
import Foundation
import DiffractoGeometry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DiffractoKitTestSupport
import Foundation
import Testing
@testable import DiffractoGeometry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DiffractoKitTestSupport
import Testing
@testable import DiffractoGeometry

Expand Down
1 change: 0 additions & 1 deletion Tests/DiffractoGeometryTests/PolicyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Testing
import Foundation
import DiffractoGeometry
import DiffractoCore
import DiffractoScattering

// MARK: - EllipseCalibration.Policy

Expand Down
1 change: 0 additions & 1 deletion Tests/DiffractoGeometryTests/RingCalibrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// equality.
//

import DiffractoKitTestSupport
import Testing
import Foundation
import DiffractoGeometry
Expand Down
1 change: 0 additions & 1 deletion Tests/DiffractoGeometryTests/RingFitCalibrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// Every test names under "RED UNDER" the production mutation that turns it red.
//

import DiffractoKitTestSupport
import Testing
import Foundation
import DiffractoGeometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Every test names under "RED UNDER" the production change that turns it red.
//

import DiffractoKitTestSupport
import Testing
import Foundation
import DiffractoGeometry
Expand Down
1 change: 0 additions & 1 deletion Tests/DiffractoGeometryTests/RingFitRobustnessTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// columns fastest, plus Gaussian noise from SplitMix64 + Box-Muller (the parity renderer's generator, seeded here).
//

import DiffractoKitTestSupport
import Testing
import Foundation
import DiffractoGeometry
Expand Down
1 change: 0 additions & 1 deletion Tests/DiffractoGeometryTests/RingOverlayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// app source, NOT from this Swift. Closed forms (circle, axis vertex) are hand-derived and checked beside them.
//

import DiffractoKitTestSupport
import Foundation
import Testing
import DiffractoGeometry
Expand Down
1 change: 0 additions & 1 deletion Tests/DiffractoGeometryTests/RingScaleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// 3.3e-15 for R, tools/pins/ring-calibration/q-pins.py); (2) the linear helper and the file comparison, closed forms.
//

import DiffractoKitTestSupport
import Foundation
import Testing
import DiffractoGeometry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import DiffractoKitTestSupport
import Foundation
import Testing
import simd
import DiffractoCore
import DiffractoOrientation

/// Pins: tools/pins/orientation-symmetry/family-real-pins.py. Real py4DSTEM `Crystal`s (0.14.19 at f050d207, pymatgen 2025.1.9 and spglib 2.8.0 in
Expand All @@ -11,7 +10,6 @@ import DiffractoOrientation
/// order is pymatgen's. Written tolerance: 1e-7 absolute (the reference's tolerance; was 1e-12) on family entries (float64 sums of three products of order 1). Columns
/// within 1e-12 of a sector wall (`boundary`) are decided by BLAS rounding in NumPy and are not compared.
private struct RealPins: Decodable {
struct Lattice: Decodable { let a, b, c, alpha, beta, gamma: Double }
struct Case: Decodable { let matrix, family: [[Double]]; let hits: [Int]; let boundary: [Bool] }
struct Crystal: Decodable {
let `class`: String; let spaceGroup: Int; let symbol: String; let primary: Bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ enum ScatteringFixtures {
static let xrayNames = ["Au", "Si", "Mg", "beta_double_prime", "Cu3Au-occ", "WS2"]
}

private func relErr(_ x: Double, _ y: Double, floor: Double) -> Double { abs(x - y) / max(abs(y), floor) }

private func descendingMembers(_ ms: [MillerIndex]) -> [[Int]] {
ms.sorted { ($0.h, $0.k, $0.l) > ($1.h, $1.k, $1.l) }.map { [$0.h, $0.k, $0.l] }
}
Expand Down
1 change: 0 additions & 1 deletion Tests/DiffractoKitTestSupport/IndexFixtures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Foundation
import Testing
import DiffractoCore
import DiffractoScattering
import DiffractoGeometry

/// Structure builders shared by this target's indexing tests (a small copy of DiffractoScatteringTests' Presets: a test
/// target cannot import another).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// against the existing CPU route (`match`, `matchAll(peaks:)`), which is the reference; nothing here changes a number.
//

import DiffractoKitTestSupport
import Foundation
import Testing
import simd
Expand Down
9 changes: 4 additions & 5 deletions Tests/DiffractoOrientationTests/ACOMMatcherTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// `ACOMTemplateLibrary.project`, and planted orientations against py4DSTEM's own match_single_pattern.
//

import DiffractoKitTestSupport
import Foundation
import Testing
import simd
Expand Down Expand Up @@ -144,7 +143,7 @@ private func peaks(_ c: Pins.Case) -> [ACOMPeak] {

private let appKeys = ["al", "mg", "mono"]

private func appLibrary(_ key: String, _ crystal: Pins.Crystal) throws -> ACOMTemplateLibrary {
private func appLibrary(_ crystal: Pins.Crystal) throws -> ACOMTemplateLibrary {
let app = try #require(crystal.appRoute)
let settings = ACOMTemplateSettings(zoneAxisCount: app.zoneAxisCount,
excitation: .appCurvature(wavelengthAngstrom: crystal.wavelength))
Expand All @@ -168,7 +167,7 @@ struct ACOMAppRouteTests {
/// The beam directions are the apps' fundamental-zone samples; the templates are their polar images and spots.
@Test(arguments: appKeys) func zoneAxesTemplatesAndSpotsEqualTheTranscription(key: String) throws {
let c = try #require(try fixture().crystals[key])
let lib = try appLibrary(key, c)
let lib = try appLibrary(c)
let app = try #require(c.appRoute)
let axes = vectors(f8(app.axes))
#expect(lib.zoneAxes.count == axes.count)
Expand Down Expand Up @@ -201,7 +200,7 @@ struct ACOMAppRouteTests {
/// runner-up, the in-plane angle, the orientation matrix and (m-3m) the reduced Euler angles.
@Test(arguments: appKeys) func matchesEqualTheTranscription(key: String) throws {
let c = try #require(try fixture().crystals[key])
let lib = try appLibrary(key, c)
let lib = try appLibrary(c)
let matcher = try #require(ACOMMatcher(library: lib))
var worstScores = 0.0, worstScore = 0.0, worstMatrix = 0.0, worstPolar = 0.0
for (k, cs) in try #require(c.appRoute).cases.enumerated() {
Expand Down Expand Up @@ -600,7 +599,7 @@ struct ACOMMetalTests {
var worst: Float = 0, cases = 0
for key in appKeys {
let c = try #require(try fixture().crystals[key])
let lib = try appLibrary(key, c)
let lib = try appLibrary(c)
let matcher = try #require(ACOMMatcher(library: lib))
guard matcher.isMetalAvailable else { return }
let pinned = try #require(c.appRoute).cases
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DiffractoKitTestSupport
import Testing
import simd
@testable import DiffractoOrientation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// lives with the pins; these are the closed forms.
//

import DiffractoKitTestSupport
import Testing
import Foundation
import simd
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import DiffractoKitTestSupport
import Foundation
import Testing
import simd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
// Role: what the tolerances in Å⁻¹ mean on a particular detector.
//

import DiffractoKitTestSupport
import Testing
import Foundation
import simd
import DiffractoCore
import DiffractoScattering
import DiffractoOrientation

@Suite struct PhaseVectorResolutionTests {
Expand Down
Loading