[med-svn] [Git][med-team/simrisc][upstream] New upstream version 15.03.00

Frank B. Brokken (@fbb-guest) gitlab at salsa.debian.org
Sat Jul 1 16:29:53 BST 2023



Frank B. Brokken pushed to branch upstream at Debian Med / simrisc


Commits:
b7db6990 by Frank B. Brokken at 2023-07-01T17:29:10+02:00
New upstream version 15.03.00
- - - - -


27 changed files:

- VERSION
- changelog
- documentation/man/simrisc.yo
- documentation/man/simriscparams.yo
- growth/growth.h
- growth/growth1.cc
- growth/setselfdetect.cc
- growth/writeparameters.cc
- loop/caseinit.cc
- loop/characteristics.cc
- loop/gencases.cc
- loop/postscreen.cc
- options/options1.cc
- probgroup/probgroup.h
- probgroup/probgroup.ih
- probgroup/probindexof.cc
- survival/cptvsdrow.cc
- survival/survival.h
- survival/survival.ih
- tumor/characteristics.cc
- tumor/functionf.cc
- tumor/functionq.cc
- tumor/functionz.cc
- tumor/reset.cc
- tumor/setdeathage.cc
- tumor/tumor.h
- tumor/tumor.ih


Changes:

=====================================
VERSION
=====================================
@@ -1,3 +1,3 @@
 #define AUTHOR  "Frank B. Brokken (f.b.brokken at rug.nl)";
-#define VERSION "15.02.00"
+#define VERSION "15.03.00"
 #define YEARS "2020-2023"


=====================================
changelog
=====================================
@@ -1,3 +1,16 @@
+simrisc (15.03.00)
+
+  * Repaired survival/cptvsdrow: d_vsdRow was set to S3's row instead of
+    S4's element index, which also resulted in errors in computing, e.g., the
+    number of interval cancers. Because of this bug Simrisc before 15.03.00
+    should not anymore be used for lung cancer simulations. Using Simrisc for
+    breast cancer simulations is OK.
+
+  * When using lung cancer simulations the parameters written to file now
+    correctly report the lung cancer parameters.
+
+ -- Frank B. Brokken <f.b.brokken at rug.nl>  Sat, 01 Jul 2023 15:34:15 +0200
+
 simrisc (15.02.00)
 
   * Costs values are now stored in size_t instead of in uint16_t variables 


=====================================
documentation/man/simrisc.yo
=====================================
@@ -84,7 +84,7 @@ filenames) are capitalized, all other single-letter options are lowercase.
 
        Be advised that the default configuration file specifies tt(Screening
         Mammo) rounds, which must either be changed to tt(CT) in locally used
-        configuration files or in tt(analysis:) sections (see section
+        configuration files or in tt(Analysis:) sections (see section
         bf(ANALYSES) below);
 
     it() lsoption(config)(C)(path)nl()
@@ -457,10 +457,14 @@ manpageseealso()
 COMMENT(
         manpagediagnostics()
 
-    manpagebugs()
-        too early for that...
 EDN)
 
+manpagebugs()
+
+Versions before version 15.03.00 should not be used for lung cancer
+simulations. The bug invalidating lung cancer simulations was repaired in
+version 15.03.00.
+
 includefile(include/trailer.yo)
 
 


=====================================
documentation/man/simriscparams.yo
=====================================
@@ -251,7 +251,7 @@ optional):
         sensitivity:    5 - *:  100
 
         #               mean    stddev  dist
-        specificity:    99.2    .076    Normal
+        specificity:    .992    .076    Normal
             )
 
     itt(Mammo:)
@@ -310,9 +310,9 @@ optional):
         following specifications:
        verb(
         costs:          280
-        #               proportion  spread      dist
-        sensitivity:      .94        .005       Normal
-        specificity:      .95        .005       Normal
+        #               proportion
+        sensitivity:      .94
+        specificity:      .95
         )
     )
 
@@ -696,7 +696,7 @@ parameters.
 manpagesection(PARAMETER RESPECIFICATION)
 
 Parameters can be respecified by defining a separate parameter configuration
-file or by providing alternate parameter specifications in tt(analysis:)
+file or by providing alternate parameter specifications in tt(Analysis:)
 sections of the program's input file, or by providing alternative parameter
 specifications as command-line arguments (cf. the bf(simrisc)(1) man-page)
 
@@ -708,10 +708,10 @@ manpageseealso()
 
      bf(simrisc)(1)
 
-COMMENT(
-    manpagebugs()
+manpagebugs()
 
-        too early for that ...
-END)
+Versions before version 15.03.00 should not be used for lung cancer
+simulations. The bug invalidating lung cancer simulations was repaired in
+version 15.03.00.
 
 includefile(include/trailer.yo)


=====================================
growth/growth.h
=====================================
@@ -27,11 +27,11 @@ class Growth
 {
     StringVect d_base;
 
-    bool    d_bc;               // --cancer: breast was specified
+    bool    d_bc;               // not --cancer: breast was specified
     double  d_start;
 
-    double  d_selfSD;
-    VSD     d_selfMean;
+    double  d_selfSD;           // SD of d_selfMean's mean value
+    VSD     d_selfMean;         // mean and SD/Distr. used when 'vary'is set
 
     AgeGroupVSDvect d_doublingTime;
     AgeGroupVSD const &(Growth::*d_ageGroupVSD)(uint16_t idx) const;
@@ -39,13 +39,13 @@ class Growth
     public:
         Growth();
 
-        AgeGroupVSD const &ageGroupVSD(uint16_t idx) const;
+        AgeGroupVSD const &ageGroupVSD(uint16_t idx) const;             // .f
 
         void vary(std::ostream &out);
 
-        double start() const;
-        VSD const &selfMu() const;
-        double selfSigma() const;
+        double start() const;                                           // .f
+        VSD const &selfMu() const;                                      // .f
+        double selfSigma() const;                                       // .f
 
         void writeParameters(std::ostream &out) const;
 


=====================================
growth/growth1.cc
=====================================
@@ -4,6 +4,7 @@
 Growth::Growth()
 :
     d_base{ "Tumor:", "Growth:", "" },
+    d_bc{ Globals::isBreast() },
     d_selfMean(VARY_NONNEG)
 {
     setStart();


=====================================
growth/setselfdetect.cc
=====================================
@@ -1,4 +1,4 @@
-//#define XERR
+#define XERR
 #include "growth.ih"
 
 void Growth::setSelfDetect()


=====================================
growth/writeparameters.cc
=====================================
@@ -7,14 +7,28 @@ void Growth::writeParameters(ostream &out) const
 
     out << "    Growth:\n"
            "      diameters:\n" <<
-           setw(6) << ' ' << "start:                 " <<
+           setw(8) << ' ' << "start:                 " <<
                                         setw(4) << d_start << '\n' <<
-           setw(6) << ' ' << "self-detect std.dev.:  " <<
+           setw(8) << ' ' << "self-detect std.dev.:  " <<
                                         setw(4) << d_selfSD << '\n' <<
-           setw(6) << ' ' << "self-detect mean:      " <<
-                                        d_selfMean << '\n';
+           setw(8) << ' ' << "self-detect mean:      " <<
+                                        d_selfMean << '\n' <<
+           setw(6) << ' ' << "DoublingTime:\n";
 
-    AgeGroupVSD::fmt(8, 1, 2, 0, 2);
-    out << setw(6) << ' ' << "DoublingTime:\n" <<
-           d_doublingTime << '\n';
+    if (d_bc)
+    {
+        AgeGroupVSD::fmt(8, 1, 2, 0, 2);
+        out << d_doublingTime << '\n';
+    }
+    else
+    {
+        auto const &first = d_doublingTime.front();
+        double sd = first.stdDev();
+        
+        out << setw(8) << ' ' << "value: " << first.value() << '\n';
+        if (sd >= 0)
+            out << setw(8) << ' ' << "std.dev: " << sd << '\n';
+
+        out.put('\n');
+    }
 }


=====================================
loop/caseinit.cc
=====================================
@@ -1,6 +1,8 @@
 #define XERR
 #include "loop.ih"
 
+extern size_t g_caseIdx;
+
 void Loop::caseInit()
 {
     g_log << "\nLoop::caseInit\n";


=====================================
loop/characteristics.cc
=====================================
@@ -1,28 +1,14 @@
-//#define XERR
+#define XERR
 #include "loop.ih"
 
 // treatmentDeath(): characteristics(LEFT_POST, TUMOR_POST);
 
-extern size_t g_caseIdx;
-extern size_t g_err;
-
 void Loop::characteristics(Status natural, Status tumor)
 {
-//    auto hit =
-//        [&]()
-//        {
-//            return natural == LEFT_POST and tumor == TUMOR_POST and
-//                   g_caseIdx >= g_err;
-//        };
-
-
-//if (hit())xerr("tumor.charact. " << g_caseIdx);
 
                                 // the tumor was self-detected: determine
     d_tumor.characteristics();  // its characteristics
 
-//if (hit())  xerr("treatmentCosts " << g_caseIdx);
-
     d_selfDetected = true;
 
 
@@ -31,12 +17,8 @@ void Loop::characteristics(Status natural, Status tumor)
         // diameterCheck()
     d_caseCost += treatmentCosts(d_tumor.selfDetectAge());
 
-//if (hit()) xerr("setDeathAge " << g_caseIdx);
-
     d_tumor.setDeathAge();
 
-//if (hit()) xerr("setStatus " << g_caseIdx);
-
     if (d_naturalDeathAge < d_tumor.deathAge())     // naturally caused death
         setStatus(natural, d_naturalDeathAge);
     else                                            // or tumor caused death


=====================================
loop/gencases.cc
=====================================
@@ -4,7 +4,7 @@
 // -> ORG/womanloop.cpp
 
 size_t g_caseIdx;           // -> loop.ih       if (caseIdx > 24842)
-size_t g_err = 4726;
+size_t g_err = 2262;
 
 void Loop::genCases(size_t iter, size_t nCases)
 {
@@ -29,7 +29,6 @@ void Loop::genCases(size_t iter, size_t nCases)
         d_sumDeathAge += d_deathAge;
         d_totalCost += d_caseCost;
 
-//xerr("write data");
         if (dataTable.stream() and (showAll or caseIdx + 1 == nCases))
             writeData(dataTable, caseIdx);
     }


=====================================
loop/postscreen.cc
=====================================
@@ -1,4 +1,4 @@
-//#define XERR
+#define XERR
 #include "loop.ih"
 
 extern size_t g_caseIdx;


=====================================
options/options1.cc
=====================================
@@ -44,5 +44,5 @@ Options::Options()
     if (d_arg.option(&value, "log"))
         logOption(value);
 
-    setSimulationType();
+    setSimulationType();                // 'c'
 }


=====================================
probgroup/probgroup.h
=====================================
@@ -35,8 +35,8 @@ class ProbGroup
     {
         N_PROBCATS = 4,   // # of probability categories
     };
-
-    Group   d_group;
+                                            // cf Group::extract(). begin() 
+    Group   d_group;                        // not used, end() is inclusive
 
     std::vector<double> d_prob;
     std::vector<double> d_cumProbs;


=====================================
probgroup/probgroup.ih
=====================================
@@ -9,6 +9,9 @@
 
 #include "../globals/globals.h"
 
-//#include "../options/options.h"
-
 using namespace std;
+
+extern size_t g_caseIdx;
+extern size_t g_err;
+
+


=====================================
probgroup/probindexof.cc
=====================================
@@ -3,9 +3,6 @@
 
 // see README.probgroup
 
-extern size_t g_caseIdx;
-extern size_t g_err;
-
 // with Survival::cptVSDrow 'value' is the tumor diameter
 // then, the group is determined from the diameter, and in the selected
 // group the column index of that row of S3 is omputed as 'idx'
@@ -14,13 +11,6 @@ extern size_t g_err;
 RowCol ProbGroup::probIndexOf(Vector const &vect,
                                          double value, double prob)
 {
-//if (g_caseIdx >= g_err){
-//xerr("PROB INDEX FOR " << prob << " value " << value);
-//for (ProbGroup const &group: vect)
-//cerr << group.begin() << '-' << group.end() << "; ";
-//cerr<<'\n';
-//}
-
     size_t rowIdx = 0;
 
     for (ProbGroup const &group: vect)
@@ -29,16 +19,10 @@ RowCol ProbGroup::probIndexOf(Vector const &vect,
         {
             uint16_t idx = group.indexOf(prob);
 
-//            if (g_caseIdx >= g_err) xerr("INDEX " << idx);
-
-// xerr("Case  " << g_caseIdx << ", row: " << rowIdx <<
-// ", col: " << idx);
-
             return RowCol{ rowIdx, idx };
         }
         ++rowIdx;
     }
 
-//if (g_caseIdx >= g_err) xerr("NO INDEX FOUND ");
     return RowCol{ static_cast<uint16_t>(string::npos), 0 };
 }


=====================================
survival/cptvsdrow.cc
=====================================
@@ -1,13 +1,10 @@
-//#define XERR
+#define XERR
 #include "survival.ih"
 
-extern size_t g_caseIdx;
-extern size_t g_err;
-
-    // determine the row of d_vsdMatrix to use by finding the rowindex in s3
-    // containing 'diameter' and then computing the lowest column index
-    // in that row exceeding a random proportion value. That index becomes
-    // d_vsdRow.
+    // determine the row of d_vsdMatrix to use by locating the row in s3
+    // containing 'diameter' in its ProbGrooup.end() value. Then compute
+    // the lowest column index in that row exceeding a random proportion
+    // value. That index becomes d_vsdRow.
 RowCol Survival::cptVSDrow(double diameter)
 {
     // if diameter > 100 the last line in S3 must be used. probIndexOf uses
@@ -23,13 +20,9 @@ RowCol Survival::cptVSDrow(double diameter)
                                     Random::instance().uniformVSD()
                                 );
 
-    d_vsdRow = rowCol.first;
+    d_vsdRow = rowCol.second;
 
     g_log << "      Survival::cptVSDRow: S3 row = " << d_vsdRow <<
                                         " for diameter " << diameter << '\n';
-
     return rowCol;
 }
-
-//                                    Random::instance().uniform()
-//                                    Random::instance().uniformCase()


=====================================
survival/survival.h
=====================================
@@ -61,7 +61,10 @@ class Survival
         // computes d_vsdRow using S3, S4 and the tumor diameter (calls
         // cptVSDrow()).
 
-    VSDmatrix d_vsdMatrix;
+                                    // 1st idx: BC: always 0
+                                    //          LC: 0..3 for lung0..lung4
+                                    // 2nd idx: elements contain the BC/LC 
+    VSDmatrix d_vsdMatrix;          //      a..d VSD params (0: a, thru 3: d)
 
     ProbGroup::Vector d_s3;         // contains the lines of S3
     Uint16Vect d_bc;                // contains the BC: specifications


=====================================
survival/survival.ih
=====================================
@@ -10,4 +10,7 @@
 #include "../parser/parser.h"
 #include "../log/log.h"
 
+extern size_t g_caseIdx;
+extern size_t g_err;
+
 using namespace std;


=====================================
tumor/characteristics.cc
=====================================
@@ -1,15 +1,9 @@
-//#define XERR
+#define XERR
 #include "tumor.ih"
 
-extern size_t g_caseIdx;
-extern size_t g_err;
-
 //  (ORG: calculateSize)
 void Tumor::characteristics(double age)
 {
-    //if (g_caseIdx >= g_err) xerr("AGE: " << age << ",
-    //                                  detectable age: " << d_detectableAge);
-
     check("size");
 
     if ((d_present = (d_detectableAge <= age)))            // there is a tumor
@@ -32,7 +26,4 @@ void Tumor::characteristics(double age)
     }
 
     d_rowCol = d_survival.setVSD(d_diameter);
-
-//if (g_caseIdx >= g_err) xerr(" diameter = " << d_diameter);
-
 }


=====================================
tumor/functionf.cc
=====================================
@@ -1,4 +1,4 @@
-//#define XERR
+#define XERR
 #include "tumor.ih"
 
 extern size_t g_caseIdx;
@@ -6,28 +6,6 @@ extern size_t g_err;
 
 double Tumor::functionF(double years) const
 {
-///xerr(1 << ' ' << reinterpret_cast<void *>(d_functionQ) << \ <-*****
-///          ' ' << reinterpret_cast<void *>(d_functionZ) << '\n');
-
-//xerr("a..d: " << d_survival[0].value() << ' ' << \ .
-//                d_survival[1].value() << ' ' <<  \ .
-//                d_survival[2].value() << ' ' <<  \ .
-//                d_survival[3].value());
-
-//    auto hit =
-//        [&]()
-//        {
-//            return
-//                   g_caseIdx >= g_err;
-//        };
-
-//if (hit())
-//{
-//xerr(years << ", diameter: " << d_diameter);
-//functionQ(years);
-//functionZ(years);
-//}
-
     return years <= 0 ?
                 1
             :


=====================================
tumor/functionq.cc
=====================================
@@ -1,4 +1,4 @@
-//#define XERR
+#define XERR
 #include "tumor.ih"
 
 // For the std. simulations survival[0] and survival[1] are returning the
@@ -13,18 +13,5 @@ extern size_t g_err;
 
 double Tumor::functionQ(double years) const
 {
-//    auto hit =                  // tumorinfo.survival?
-//        [&]()
-//        {
-//            return
-//                   g_caseIdx >= g_err;
-//        };
-
-//if (hit())
-//{
-//xerr("d_survival[1] " << &d_survival[1]  << ' ' << d_survival[1].value());
-//xerr("d_survival[0] " << &d_survival[0]);
-//}
-
     return d_survival[0].value() * pow(years, d_survival[1].value());
 }


=====================================
tumor/functionz.cc
=====================================
@@ -3,7 +3,5 @@
 
 double Tumor::functionZ(double years) const
 {
-xerr("");
-    return d_survival[2].value() * log(years)
-           + d_survival[3].value();
+    return d_survival[2].value() * log(years) + d_survival[3].value();
 }


=====================================
tumor/reset.cc
=====================================
@@ -37,7 +37,6 @@ void Tumor::reset()
 
     d_doublingDays = random.logNormal(group.value(), group.stdDev());
 
-
     d_doublingYears = d_doublingDays / N_YEARDAYS;
 
     double selfDetectDiam = random.logNormal(d_growth.selfMu().value(),
@@ -58,12 +57,4 @@ void Tumor::reset()
              "  p(survival) =    " << d_pSurvival << "\n"
              "  preperiod =      " << d_prePeriod << "\n"
              "  detectableAge = " << d_detectableAge << '\n';
-
 }
-
-//xerr("idx: " << idx << ", value: " << group.value() << ", stdev = " <<
-//group.stdDev());
-
-//xerr("doublingdays: " << d_doublingDays);
-
-// xerr("LEAVING " << d_prePeriod << ' ' << d_detectableAge);


=====================================
tumor/setdeathage.cc
=====================================
@@ -12,14 +12,6 @@ extern size_t g_err;
 
 void Tumor::setDeathAge(double detectionAge)
 {
-//    auto hit =
-//        [&]()
-//        {
-//            return g_caseIdx >= g_err;
-//        };
-
-//if (hit()) xerr(g_caseIdx << " self detect: " << d_selfDetectAge << ' ' << detectionAge);
-
     check("death age");
 
     // interval halving: search between 0 and 100
@@ -31,9 +23,6 @@ void Tumor::setDeathAge(double detectionAge)
     {
         mid = (low + high) / 2;
 
-//if (hit()) xerr("iter: " << iter << " mid: " << mid);
-
-
         switch (weakCompare(functionF(mid), d_pSurvival))
         {
             case -1:                // use the lhs half: low..mid
@@ -55,7 +44,4 @@ void Tumor::setDeathAge(double detectionAge)
 
     g_log << "    Tumor::setDeathAge(" << detectionAge << ") = " <<
              d_deathAge << '\n';
-
-//if (hit()) xerr("death age: " << d_deathAge);
-
 }


=====================================
tumor/tumor.h
=====================================
@@ -81,7 +81,7 @@ class Tumor: public Globals
         double detectableAge() const;                               //  .f
 
         double volume() const;
-        double diameter() const;
+        double diameter() const;                                    // .f
 
         bool metastasis() const;            // only with lung cancer    .f
 
@@ -102,8 +102,6 @@ class Tumor: public Globals
 
         RowCol const &rowCol() const;                               // .f
 
-//        void s4ColIdx();                    // cpt Survival S4 column index
-
     private:
         std::ostream &insert(std::ostream &out) const;
 


=====================================
tumor/tumor.ih
=====================================
@@ -36,3 +36,6 @@ inline double Tumor::diameter(double volume)
 {
     return pow(6 / M_PI * volume, 1 / 3.);
 }
+
+extern size_t g_caseIdx;
+extern size_t g_err;



View it on GitLab: https://salsa.debian.org/med-team/simrisc/-/commit/b7db6990b1347e3126f3869fc4a10c4fbbae4401

-- 
View it on GitLab: https://salsa.debian.org/med-team/simrisc/-/commit/b7db6990b1347e3126f3869fc4a10c4fbbae4401
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230701/ceb8385b/attachment-0001.htm>


More information about the debian-med-commit mailing list