fix: custom get_destination_wells
Gitea Scan/plate-tool/pipeline/head This commit looks good
Details
Gitea Scan/plate-tool/pipeline/head This commit looks good
Details
The code here was like, stupid tbh.
This commit is contained in:
parent
94cb530de8
commit
72d81439c1
|
@ -109,21 +109,23 @@ impl TransferRegion {
|
|||
}
|
||||
|
||||
pub fn get_destination_wells(&self) -> Vec<(u8, u8)> {
|
||||
let map = self.calculate_map();
|
||||
let source_wells = self.get_source_wells();
|
||||
match &self.source_region {
|
||||
Region::Custom(c) => c.dest.clone(),
|
||||
_ => {
|
||||
let map = self.calculate_map();
|
||||
let source_wells = self.get_source_wells();
|
||||
|
||||
let mut wells = Vec::<(u8, u8)>::new();
|
||||
let mut wells = Vec::<(u8, u8)>::new();
|
||||
|
||||
// log::debug!("GDW:");
|
||||
for well in source_wells {
|
||||
if let Some(mut dest_wells) = map(well) {
|
||||
// log::debug!("Map {:?} to {:?}", well, dest_wells);
|
||||
wells.append(&mut dest_wells);
|
||||
for well in source_wells {
|
||||
if let Some(mut dest_wells) = map(well) {
|
||||
wells.append(&mut dest_wells);
|
||||
}
|
||||
}
|
||||
|
||||
wells
|
||||
}
|
||||
}
|
||||
// log::debug!("GDW END.");
|
||||
|
||||
wells
|
||||
}
|
||||
|
||||
#[allow(clippy::type_complexity)] // Resolving gives inherent associated type error
|
||||
|
@ -204,14 +206,16 @@ impl TransferRegion {
|
|||
// How many times can we replicate?
|
||||
(1..)
|
||||
.position(|n| {
|
||||
n * number_used_src_wells.0 * il_dest.0.unsigned_abs() - il_dest.0.unsigned_abs()
|
||||
n * number_used_src_wells.0 * il_dest.0.unsigned_abs()
|
||||
- il_dest.0.unsigned_abs()
|
||||
+ 1
|
||||
> d_dims.0
|
||||
})
|
||||
.unwrap() as u8,
|
||||
(1..)
|
||||
.position(|n| {
|
||||
n * number_used_src_wells.1 * il_dest.1.unsigned_abs() - il_dest.1.unsigned_abs()
|
||||
n * number_used_src_wells.1 * il_dest.1.unsigned_abs()
|
||||
- il_dest.1.unsigned_abs()
|
||||
+ 1
|
||||
> d_dims.1
|
||||
})
|
||||
|
@ -242,14 +246,12 @@ impl TransferRegion {
|
|||
.filter(|(x, y)| {
|
||||
// How many times have we replicated? < How many are we allowed
|
||||
// to replicate?
|
||||
x.checked_sub(d_ul.0)
|
||||
.unwrap()
|
||||
.div_euclid(number_used_src_wells.0 * il_dest.0.unsigned_abs())
|
||||
< count.0
|
||||
&& y.checked_sub(d_ul.1)
|
||||
.unwrap()
|
||||
.div_euclid(number_used_src_wells.1 * il_dest.1.unsigned_abs())
|
||||
< count.1
|
||||
x.checked_sub(d_ul.0).unwrap().div_euclid(
|
||||
number_used_src_wells.0 * il_dest.0.unsigned_abs(),
|
||||
) < count.0
|
||||
&& y.checked_sub(d_ul.1).unwrap().div_euclid(
|
||||
number_used_src_wells.1 * il_dest.1.unsigned_abs(),
|
||||
) < count.1
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue