Skip to content

Commit

Permalink
Remove debug print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnbr committed Mar 27, 2024
1 parent ecc1f53 commit 97c2876
Show file tree
Hide file tree
Showing 9 changed files with 340 additions and 55 deletions.
3 changes: 0 additions & 3 deletions src/api/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ impl PythonWorker {
pub fn export_numerators(&mut self, export_root: &str, format: &str) -> PyResult<String> {
self.generate_numerators();

println!("Exporting numerators");
for amplitude in self.amplitudes.container.iter_mut() {
amplitude
.export_numerator(export_root, Self::printer_options(format))
Expand All @@ -343,9 +342,7 @@ impl PythonWorker {
.export_lmb_subs(export_root, Self::printer_options(format))
.map_err(|e| exceptions::PyException::new_err(e.to_string()))
.unwrap();
println!("Exported lmb substitutions for amplitude ",)
}
println!("Exported lmb substitutions for amplitude ",);
Ok(format!("Exported lmb substitutions"))
}

Expand Down
1 change: 0 additions & 1 deletion src/cross_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ impl Amplitude {
path.join("lmb_replacement.json"),
serde_json::to_string_pretty(&rep_rules).unwrap(),
)?;
print!("HO")
}

Ok(())
Expand Down
15 changes: 10 additions & 5 deletions src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl SerializableVertexRule {
.color_structures
.iter()
.map(utils::to_str_expression)
.map(SmartString::from)
.collect(),
lorentz_structures: vertex_rule
.lorentz_structures
Expand Down Expand Up @@ -141,8 +142,8 @@ impl SerializablePropagator {
SerializablePropagator {
name: propagator.name.clone(),
particle: propagator.particle.name.clone(),
numerator: utils::to_str_expression(&propagator.numerator),
denominator: utils::to_str_expression(&propagator.denominator),
numerator: utils::to_str_expression(&propagator.numerator).into(),
denominator: utils::to_str_expression(&propagator.denominator).into(),
}
}
}
Expand Down Expand Up @@ -182,7 +183,7 @@ impl SerializableCoupling {
pub fn from_coupling(coupling: &Coupling) -> SerializableCoupling {
SerializableCoupling {
name: coupling.name.clone(),
expression: utils::to_str_expression(&coupling.expression),
expression: utils::to_str_expression(&coupling.expression).into(),
orders: coupling.orders.clone(),
value: coupling.value.map(|value| (value.re, value.im)),
}
Expand Down Expand Up @@ -317,7 +318,7 @@ impl SerializableLorentzStructure {
SerializableLorentzStructure {
name: ls.name.clone(),
spins: ls.spins.clone(),
structure: utils::to_str_expression(&ls.structure),
structure: utils::to_str_expression(&ls.structure).into(),
}
}
}
Expand Down Expand Up @@ -361,7 +362,11 @@ impl SerializableParameter {
nature: param.nature.clone(),
parameter_type: param.parameter_type.clone(),
value: param.value.map(|value| (value.re, value.im)),
expression: param.expression.as_ref().map(utils::to_str_expression),
expression: param
.expression
.as_ref()
.map(utils::to_str_expression)
.map(SmartString::from),
}
}
}
Expand Down
17 changes: 7 additions & 10 deletions src/numerator/tests.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
use symbolica::{printer::PrintOptions, representations::AtomView};

use crate::{
tensor::{SymbolicTensor, TensorStructure},
tests_from_pytest::load_amplitude_output,
};
use crate::{tensor::SymbolicTensor, tests_from_pytest::load_amplitude_output};

#[test]

#[allow(unused)]
fn lbl() {
let (model, amplitude) = load_amplitude_output(&"./src/tepst_resources/lbl/");
let (model, amplitude) = load_amplitude_output(&"./src/test_resources/lbl/");

model
.export_coupling_replacement_rules(&"./ignore/", PrintOptions::mathematica())
Expand All @@ -18,21 +15,21 @@ fn lbl() {
graph.generate_numerator(&model);

let mut numerator = graph.derived_data.numerator.clone().unwrap();
println!("{}", numerator);
// println!("{}", numerator);
for (lhs, rhs) in graph.generate_lmb_replacement_rules() {
numerator =
lhs.into_pattern()
.replace_all(numerator.as_view(), &rhs.into_pattern(), None, None);
}

println!("{}", numerator);
// println!("{}", numerator);

if let AtomView::Mul(mul) = numerator.as_view() {
let net = SymbolicTensor::mul_to_tracking_network(mul).unwrap();

println!("{}", net.dot());
// println!("{}", net.dot());
for (_, t) in net.graph.nodes {
println!("{}", t.structure());
// println!("{}", t.structure());
}
}
}
3 changes: 0 additions & 3 deletions src/tensor/symbolic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ impl SymbolicTensor {
AtomView::Var(v) => {
let mut a = Atom::new();
a.set_from_view(&v.as_view());
println!("Var: {}", a);
network.scalar_mul(&a);
}
AtomView::Num(n) => {
Expand Down Expand Up @@ -196,7 +195,6 @@ impl SymbolicTensor {
AtomView::Var(v) => {
let mut a = Atom::new();
a.set_from_view(&v.as_view());
println!("Var: {}", a);
network.scalar_mul(&a);
}
AtomView::Num(n) => {
Expand Down Expand Up @@ -268,7 +266,6 @@ impl Contract<SymbolicTensor> for SymbolicTensor {
let mut new_structure = self.structure.clone();

let expression = &other.expression * &self.expression;
println!("expression: {}", expression);
new_structure.merge(&other.structure);
Some(SymbolicTensor {
expression,
Expand Down
33 changes: 17 additions & 16 deletions src/test_resources/lbl/sources/amplitudes/lbl_box/amplitude.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,22 @@ amplitude_graphs:
loop_momentum_basis:
- q3
edge_signatures:
p4:
- - 0
- - 1
- -1
- -1
- 0
q2:
- - 1
- - 0
- 0
- 1
- 0
q3:
q1:
- - 1
- - 0
- 0
- 0
- 0
p3:
- - 0
- - 0
- 0
- 1
- 1
- 0
p2:
Expand All @@ -161,16 +161,10 @@ amplitude_graphs:
- 1
- 0
- 0
p4:
p3:
- - 0
- - 1
- -1
- -1
- 0
q1:
- - 1
- - 0
- 1
- 0
- 1
- 0
p1:
Expand All @@ -179,9 +173,16 @@ amplitude_graphs:
- 0
- 0
- 0
q3:
- - 1
- - 0
- 0
- 0
- 0
q4:
- - 1
- - -1
- 1
- 1
- 0
multi_channeling_channels: []
Loading

0 comments on commit 97c2876

Please sign in to comment.