Skip to content

Commit

Permalink
clean up scaled
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Nov 11, 2024
1 parent e872e42 commit 6586b33
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/manysearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ pub fn manysearch(
.downsample_scaled(scaled)
.expect("cannot downsample search minhash to requested scaled");
for query in query_sketchlist.iter() {
// avoid calculating details unless there is overlap

// be paranoid and confirm scaled match.
if query.minhash.scaled() != scaled {
panic!("different query scaled");
}
Expand Down
10 changes: 8 additions & 2 deletions src/multisearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub fn multisearch(
};

let ksize = selection.ksize().unwrap() as f64;
let expected_scaled = scaled; // nicer name.

let mut new_selection = selection;
new_selection.set_scaled(scaled as u32);
Expand Down Expand Up @@ -86,8 +87,13 @@ pub fn multisearch(
eprintln!("Processed {} comparisons", i);
}

if query.minhash.scaled() != against.minhash.scaled() {
panic!("different scaled");
// be paranoid and check scaled.
if query.minhash.scaled() != set_scaled {
panic!("different scaled for query");
}

if against.minhash.scaled() != set_scaled {
panic!("different scaled for against");
}

let overlap = query
Expand Down
2 changes: 2 additions & 0 deletions src/pairwise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ pub fn pairwise(
write_all: bool,
output: Option<String>,
) -> Result<(), Box<dyn std::error::Error>> {
// @CTB test for heterogenous scaled.

// Load all sigs into memory at once.
let collection = load_collection(
&siglist,
Expand Down
3 changes: 2 additions & 1 deletion src/python/tests/test_manysearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ def test_simple_scaled_fail(runtmp, capfd, indexed, zip_query):
make_file_list(against_list, [against])

if indexed:
against_list = index_siglist(runtmp, against_list, runtmp.output("db"))
against_list = index_siglist(runtmp, against_list, runtmp.output("db"),
scaled=100_000)

if zip_query:
query_list = zip_siglist(runtmp, query_list, runtmp.output("query.zip"))
Expand Down

0 comments on commit 6586b33

Please sign in to comment.