njoy / ENDFtk

Toolkit for reading and interacting with ENDF-6 formatted files
Other
34 stars 5 forks source link

Feature/mf33 #141

Closed nathangibson14 closed 3 years ago

nathangibson14 commented 3 years ago

Built off current develop, should be fun when we get all the 20s into develop, too. A few clashes expected 😢

Complete implementation of MF33 in both C++ and Python.

whaeck commented 3 years ago

Alea iacta est ...

nathangibson14 commented 3 years ago

I just renamed Subsection to ReactionBlock, NIType to ExplicitCovariance, and NCType to DerivedCovariance. Any complaints with those?

-- Nathan A. Gibson Staff Scientist, XCP-5 Nuclear Data Team Los Alamos National Laboratory (505) 665-2338

From: Wim Haeck @.> Reply-To: njoy/ENDFtk @.> Date: Monday, July 26, 2021 at 5:12 PM To: njoy/ENDFtk @.> Cc: "Gibson, Nathan Andrew" @.>, Author @.***> Subject: [EXTERNAL] Re: [njoy/ENDFtk] Feature/mf33 (#141)

@whaeck requested changes on this pull request.

Nicely done. Some of the interface function names are debatable (looking at NC and NI) - as we've discussed previously - but we can change these at a later stage.

Basically, the remarks are for consistency in documentation and testing:


In python/src/file/33.python.cpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r675845575:

+

+// declarations - sections

+void wrapSection_33( python::module&, python::module& );

+

+void wrapFile_33( python::module& module, python::module& viewmodule ) {

+

You should drop the neutron since these could also be for incident charged particles - I wager.


In python/test/Test_ENDFtk_MF33_CovariancePairs.pyhttps://github.com/njoy/ENDFtk/pull/141#discussion_r675850152:

  • self.assertEqual( 4, chunk.number_values )

to_string should go here


In src/ENDFtk/section/33/Subsection/src/readNI.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676062690:

  • Log::info( "MT value: {}", MT );

Some nitpicking: output the LB value after the list of legal LB values. The MT line is not required.


In src/ENDFtk/section/33/Subsection/src/readNC.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676062735:

  • Log::info( "MT value: {}", MT );

Some nitpicking: output the LTY value after the list of legal LTY values. The MT line is not required.


In src/ENDFtk/section/33/Subsection/src/ctor.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676062967:

+Subsection( Iterator& begin,

+try :

nitpicking: alignment of code


In src/ENDFtk/section/33/Subsection/src/ctor.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676063216:

  • Log::info( "Trouble while reading section {} of File 33 of Material {}",

This is a Subsection, so the message is inappropriate (and it would be added twice once the try ... catch in the actual MF33 section is encountered). A better message would be:

Log::info( "Encountered error while constructing a covariance subsection" );

In src/ENDFtk/section/33/Subsection/src/ctor.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676063255:

    • NI Only.

Argument documentation is missing.


In src/ENDFtk/section/33/Subsection/src/ctor.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676063348:

    • NC Only.

Argument documentation is missing


In src/ENDFtk/section/33/Subsection/src/NC.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676063471:

@@ -0,0 +1,21 @@

+long NC() const {

nitpicking: documentation is missing


In src/ENDFtk/section/33/Subsection.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676063943:

  • double xmf1_;

You should make these integers, or even unsigned integers. It's not because the ENDF format says that it is stored as a double that you need to interpret it as a double. Conversion to double is done when writing out the file.


In src/ENDFtk/section/33/Subsection.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676064119:

  • double XMF1() const { return this->xmf1_; }

+

These return types should be integers. You're actually converting the mat1 and mt1 to doubles from integers. I assume this is a copy/paste error.


In src/ENDFtk/section/33/Subsection.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676064339:

    • @brief Return the section number for the second cross section

This is for NI, not NC


In src/ENDFtk/section/33/Subsection.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676064362:

+

this is for NI, not NC


In src/ENDFtk/section/33/DerivedRedundant/src/NC.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676064808:

@@ -0,0 +1,4 @@

+/**

this is an MF33 component


In src/ENDFtk/section/33.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676064919:

+#include "range/v3/range/conversion.hpp"

+#include "range/v3/view/all.hpp"

+#include "range/v3/view/concat.hpp"

+#include "range/v3/view/drop_exactly.hpp"

+#include "range/v3/view/take_exactly.hpp"

+#include "range/v3/view/stride.hpp"

+#include "ENDFtk/ControlRecord.hpp"

+#include "ENDFtk/ListRecord.hpp"

+#include "ENDFtk/readSequence.hpp"

+#include "ENDFtk/section.hpp"

+

+namespace njoy {

+namespace ENDFtk {

+namespace section{

+

+namespace hana = boost::hana;

Where are you using hana?


In python/src/section/33/CovariancePairs.python.cpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676992832:

+

Now I'm really nitpicking: you should use a capital T since it's like that everywhere else in ENDFtk


In python/test/Test_ENDFtk_MF33_CovariancePairs.pyhttps://github.com/njoy/ENDFtk/pull/141#discussion_r676995047:

  • self.assertEqual( 2, chunk.number_pairs )

+

For these tests I would use the keywords to make sure they are correctly set in the bindings.


In python/test/Test_ENDFtk_MF33_Section.pyhttps://github.com/njoy/ENDFtk/pull/141#discussion_r676995795:

  • the data is retrieved from a tree element and parsed

You're not verifying limp when parsing from a tape?


In src/ENDFtk/section/33/CovariancePairs.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676996610:

  • long numberValues() const { return this->NT(); }

+

ENDF speak should be all caps, even if the ENDF manual uses something differently. Just for consistency.


In src/ENDFtk/section/33/CovariancePairs/test/CovariancePairs.test.cpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676998418:

+// other includes

+

+// convenience typedefs

+using namespace njoy::ENDFtk;

+using CovariancePairs = section::Type< 33 >::CovariancePairs;

+

+std::string chunkLB1();

+std::string invalidLB();

+std::string inconsistentNT();

+void verifyChunkLB1( const CovariancePairs& );

+void verifyChunkLB3( const CovariancePairs& );

+

+

+SCENARIO( "CovariancePairs" ) {

+

You should test LB=1 and LB=3 using separate GIVEN parts (see for instance ContinuumENergyAngle test)


In src/ENDFtk/section/33/DerivedRatioToStandard/src/NC.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676998583:

@@ -0,0 +1,4 @@

+/**

This is MF33


In src/ENDFtk/section/33/DerivedRatioToStandard/src/ctor.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r676999660:

@@ -0,0 +1,80 @@

+//! @todo pybind11 variant needs default constructor workaround

+#ifdef PYBIND11

+/**

+DerivedRatioToStandard() = default;

+#endif

+

+/**

I'll have to look more closely at this.


In src/ENDFtk/section/33/Subsection/src/readNC.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r677001946:

@@ -0,0 +1,48 @@

+template< typename Iterator >

+static std::vector< NCType >

+readNC( Iterator& begin,

The only thing you need off here is the L2 value right?

Use that as an argument to the read constructor instead of moving an essentially useless CONT record into the components.


In src/ENDFtk/section/33/Subsection/src/readNI.hpphttps://github.com/njoy/ENDFtk/pull/141#discussion_r677002569:

@@ -0,0 +1,53 @@

+template< typename Iterator >

+static std::vector< NIType >

+readNI( Iterator& begin,

Here you're warranted to move the ListRecord into the components, because they are the components. With the CONT record in the NC subsections, it's not the same.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/njoy/ENDFtk/pull/141#pullrequestreview-714100779, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAK6KQ7NC3L763IB3XRW4ALTZXTXLANCNFSM5A4UGJRA.

nathangibson14 commented 3 years ago

This should be ready to go. I address at least most of the comments, and then found a few of my own issues (e.g., missing a constructor for CovariancePairs on the Python side. Looks like the CI passes again.