Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions news/rwp-tol-refine.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Add Rwp threshold minRwpVar for lsq.Refine()

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
2 changes: 1 addition & 1 deletion requirements/conda.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
numpy
libobjcryst>=2026.2.0
libobjcryst>=2026.3.0
libboost-devel
libboost-python
packaging # for matplotlib version parsing in powderpattern.py
Expand Down
14 changes: 9 additions & 5 deletions src/extensions/lsq_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,17 @@ using namespace ObjCryst;
namespace {

bool _SafeRefine(LSQNumObj & lsq, REAL maxChi2factor, int nbCycle, bool useLevenbergMarquardt,
const bool silent, const bool callBeginEndOptimization,const float minChi2var)
const bool silent, const bool callBeginEndOptimization,const float minChi2var,
const float minRwpVar)
{
CaptureStdOut gag;
if(!silent) gag.release();

std::list<RefinablePar*> vnewpar;
std::list<const RefParType*> vnewpartype;
return lsq.SafeRefine(vnewpar, vnewpartype, nbCycle, useLevenbergMarquardt, silent,
callBeginEndOptimization, minChi2var);
return lsq.SafeRefine(vnewpar, vnewpartype, maxChi2factor, nbCycle,
useLevenbergMarquardt, silent,
callBeginEndOptimization, minChi2var, minRwpVar);
}

bp::dict _GetVarianceCovarianceMap(LSQNumObj & lsq)
Expand Down Expand Up @@ -89,13 +91,15 @@ void wrap_lsq()
bp::arg("useLevenbergMarquardt")=false,
bp::arg("silent")=false,
bp::arg("callBeginEndOptimization")=true,
bp::arg("minChi2var")=0.01))
bp::arg("minChi2var")=0.01,
bp::arg("minRwpVar")=-1))
.def("SafeRefine", &_SafeRefine,
(bp::arg("maxChi2factor")=1.01,bp::arg("nbCycle")=1,
bp::arg("useLevenbergMarquardt")=false,
bp::arg("silent")=false,
bp::arg("callBeginEndOptimization")=true,
bp::arg("minChi2var")=0.01))
bp::arg("minChi2var")=0.01,
bp::arg("minRwpVar")=-1))
.def("Rfactor", &LSQNumObj::Rfactor)
.def("RwFactor", &LSQNumObj::RwFactor)
.def("ChiSquare", &LSQNumObj::ChiSquare)
Expand Down
Loading