Skip to content

Commit

Permalink
Revert changes to base call params
Browse files Browse the repository at this point in the history
  • Loading branch information
kneasle committed Jul 20, 2024
1 parent 568d937 commit 1daa738
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 39 deletions.
19 changes: 9 additions & 10 deletions monument/cli/src/toml_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ pub struct TomlFile {
/// If `true`, then singles are excluded from `base_calls`. This is mutually exclusive with
/// `singles_only`
#[serde(default)]
base_bobs_only: bool,
bobs_only: bool,
/// If `true`, then bobs are excluded from `base_calls`. This is mutually exclusive with
/// `bobs_only`.
#[serde(default)]
base_singles_only: bool,
singles_only: bool,
/// The weight given to each bob from `base_calls`
base_bob_weight: Option<f32>,
bob_weight: Option<f32>,
/// The weight given to each single from `base_calls`
base_single_weight: Option<f32>,
single_weight: Option<f32>,
/// Which calls to use in the compositions
#[serde(default)]
calls: Vec<CustomCall>,
Expand Down Expand Up @@ -296,18 +296,18 @@ impl TomlFile {

// Suggest `{bobs,singles}_only` if the user gives calls an extreme negative weight
const BIG_NEGATIVE_WEIGHT: f32 = -100.0;
if let Some(w) = self.base_bob_weight {
if let Some(w) = self.bob_weight {
if w <= BIG_NEGATIVE_WEIGHT {
log::warn!("It looks like you're trying to make a singles only composition; consider using `singles_only = true` explicitly.");
}
}
if let Some(w) = self.base_single_weight {
if let Some(w) = self.single_weight {
if w <= BIG_NEGATIVE_WEIGHT {
log::warn!("It looks like you're trying to make a bobs only composition; consider using `bobs_only = true` explicitly.");
}
}
// Check that `{bobs,singles}_only` aren't set at the same time
if self.base_bobs_only && self.base_singles_only {
if self.bobs_only && self.singles_only {
return Err(anyhow::Error::msg(
"Composition can't be both `bobs_only` and `singles_only`",
));
Expand All @@ -316,9 +316,8 @@ impl TomlFile {
Ok(monument::parameters::base_calls(
id_gen,
base_call_type,
(!self.base_singles_only).then_some(self.base_bob_weight.unwrap_or(DEFAULT_BOB_WEIGHT)),
(!self.base_bobs_only)
.then_some(self.base_single_weight.unwrap_or(DEFAULT_SINGLE_WEIGHT)),
(!self.singles_only).then_some(self.bob_weight.unwrap_or(DEFAULT_BOB_WEIGHT)),
(!self.bobs_only).then_some(self.single_weight.unwrap_or(DEFAULT_SINGLE_WEIGHT)),
stage,
))
}
Expand Down
8 changes: 4 additions & 4 deletions monument/doc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
- [require_atw = false](./params/require_atw.md)
- [Calls](./params/_sec04-calls.md)
- [base_calls = "near"](./params/base_calls.md)
- [base_bobs_only = false](./params/base_bobs_only.md)
- [base_singles_only = false](./params/base_singles_only.md)
- [base_bob_weight = -1.8](./params/base_bob_weight.md)
- [base_single_weight = -2.5](./params/base_single_weight.md)
- [bobs_only = false](./params/bobs_only.md)
- [singles_only = false](./params/singles_only.md)
- [bob_weight = -1.8](./params/bob_weight.md)
- [single_weight = -2.5](./params/single_weight.md)
- [calls = \[\]](./params/calls.md)
- [place_notation](./params/calls/place_notation.md)
- [symbol](./params/calls/symbol.md)
Expand Down
5 changes: 0 additions & 5 deletions monument/doc/src/params/base_bob_weight.md

This file was deleted.

8 changes: 0 additions & 8 deletions monument/doc/src/params/base_bobs_only.md

This file was deleted.

8 changes: 4 additions & 4 deletions monument/doc/src/params/base_calls.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ base_calls = "none" # no base calls, only what you've added

These can be customised with these other parameters:

- [`base_bobs_only`](base_bobs_only.md)
- [`base_singles_only`](base_singles_only.md)
- [`base_bob_weight`](base_bob_weight.md)
- [`base_single_weight`](base_single_weight.md)
- [`bobs_only`](bobs_only.md)
- [`singles_only`](singles_only.md)
- [`bob_weight`](bob_weight.md)
- [`single_weight`](single_weight.md)
5 changes: 0 additions & 5 deletions monument/doc/src/params/base_single_weight.md

This file was deleted.

6 changes: 5 additions & 1 deletion monument/doc/src/params/bob_weight.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# bob_weight
# `bob_weight`

**Defaults to `-1.8`.**

Sets the score given to the bob generated by [`base_calls`](base_calls.md).
7 changes: 7 additions & 0 deletions monument/doc/src/params/bobs_only.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# `bobs_only`

**Defaults to `false`.**

If `true`, then [`base_calls`](base_calls.md) will only generate bobs, and not singles.

Note that this is incompatible with [`singles_only`](singles_only.md) (since a set of calls
can't be both bobs-only and singles-only).
5 changes: 5 additions & 0 deletions monument/doc/src/params/single_weight.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `single_weight`

**Defaults to `-2.5`.**

Sets the score given to the single generated by [`base_calls`](base_calls.md).
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# `base_singles_only`
# `singles_only`

**Defaults to `false`.**

If `true`, then [`base_calls`](base_calls.md) will only generate singles, and not bobs.

Note that this is incompatible with [`base_bobs_only`](base_bobs_only.md) (since a call set
Note that this is incompatible with [`bobs_only`](bobs_only.md) (since a set of calls
can't be both bobs-only and singles-only).

0 comments on commit 1daa738

Please sign in to comment.