ComPWA / expertsystem

Rule based particle reaction problem solver on a quantum number level
http://expertsystem.rtfd.io
1 stars 3 forks source link

Improve recipe file structure #73

Closed spflueger closed 3 years ago

spflueger commented 4 years ago

[Estimated effort: 2h]

redeboer commented 4 years ago

@spflueger Maybe transfer this issue to the expertsystem repo?

spflueger commented 4 years ago

yeah good point

redeboer commented 4 years ago

Add Magnitude and Phase as individual Parameters instead of defining a Type inside Parameter. This will remove some overhead and the code will still be flexible enough. So the content of Magnitude and Phase will just follow Parameter.

Is that the case now since 0.1.2a0? Or do you mean something else?

redeboer commented 4 years ago

Refer to object directly instead of Class tags

The syntax from CoherentIntensity: on is invalid YAML syntax. That's why we need a Class tag.

spflueger commented 4 years ago

Refer to object directly instead of Class tags

The syntax from CoherentIntensity: on is invalid YAML syntax. That's why we need a Class tag.

How so?

spflueger commented 4 years ago

Add Magnitude and Phase as individual Parameters instead of defining a Type inside Parameter. This will remove some overhead and the code will still be flexible enough. So the content of Magnitude and Phase will just follow Parameter.

Is that the case now since 0.1.2a0? Or do you mean something else?

Yeah this part is already solved. We could remove the Parameters tag inside Amplitudes, so instead of writing

Parameters:
  Magnitude: Magnitude_J/psi_to_f2(1270)_2+gamma_1;f2(1270)_to_pi0_0+pi0_0;
  Phase: Phase_J/psi_to_f2(1270)_2+gamma_1;f2(1270)_to_pi0_0+pi0_0;

we could just write

Magnitude: Magnitude_J/psi_to_f2(1270)_2+gamma_1;f2(1270)_to_pi0_0+pi0_0;
Phase: Phase_J/psi_to_f2(1270)_2+gamma_1;f2(1270)_to_pi0_0+pi0_0;
redeboer commented 4 years ago
      - CoherentIntensity:
        Component: coherent_J/psi_-1_to_gamma_-1+pi0_0+pi0_0
        Amplitudes:

Either requires indentation before Component: and Amplitudes: or Class: CoherentIntensity.

spflueger commented 4 years ago
- CoherentIntensity:
    Component: coherent_J/psi_-1_to_gamma_-1+pi0_0+pi0_0
    Amplitudes:

Like this right? But that's what I meant

redeboer commented 4 years ago

That's right. Yeah I guess then this format would be possible.

redeboer commented 4 years ago

See https://github.com/ComPWA/expertsystem/pull/154#issuecomment-668664529

spflueger commented 4 years ago

I believe recursion will not even be necessary, since the nesting is not arbitrary and too deep. With the use of oneOf and specifiying properties one should be able to solve this.

See https://stackoverflow.com/questions/24023536/how-do-i-require-one-field-or-another-or-one-of-two-others-but-not-all-of-them for more info