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/fix-erase-all-param-set.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* Fix EraseAllParamSet binding for compiled RefinableObj

**Security:**

* <news item>
12 changes: 6 additions & 6 deletions src/extensions/refinableobj_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ RefinablePar& _GetParNotFixedLong(RefinableObj& obj, const long i)
return obj.GetParNotFixed(i);
}

void _EraseAllParamSet(RefinableObj& obj)
{
obj.EraseAllParamSet();
}


class RefinableObjWrap : public RefinableObj,
public wrapper<RefinableObj>
Expand All @@ -103,11 +108,6 @@ class RefinableObjWrap : public RefinableObj,
RefinableObj::SetDeleteRefParInDestructor(false);
}

// Fix for const void issue
void EraseAllParamSet() {
this->RefinableObj::EraseAllParamSet();
}

const std::string& default_GetClassName() const
{ return this->RefinableObj::GetClassName(); }

Expand Down Expand Up @@ -484,7 +484,7 @@ void wrap_refinableobj()
return_value_policy<copy_const_reference>())
.def("GetParamSet_ParNotFixedHumanValue",
&RefinableObj::GetParamSet_ParNotFixedHumanValue)
.def("EraseAllParamSet", &RefinableObjWrap::EraseAllParamSet)
.def("EraseAllParamSet", &_EraseAllParamSet)
.def("GetParamSetName", &RefinableObj::GetParamSetName,
return_value_policy<copy_const_reference>())
.def("SetLimitsAbsolute", ( void (RefinableObj::*)
Expand Down
13 changes: 12 additions & 1 deletion tests/test_lsq.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import pytest

from pyobjcryst import refinableobj
from pyobjcryst import ObjCrystException, refinableobj
from pyobjcryst.diffractiondatasinglecrystal import (
DiffractionDataSingleCrystal,
)
Expand Down Expand Up @@ -56,6 +56,17 @@ def test_lsq_get_refined_obj(self):
lsq.PrepareRefParList()
# print(lsq.GetCompiledRefinedObj())

def test_lsq_compiled_refined_obj_erase_all_param_set(self):
"""Check parameter sets can be erased on compiled refined
objects."""
lsq = LSQ()
lsq.SetRefinedObj(self.d, 0, True, True)
lsq.PrepareRefParList()
refobj = lsq.GetCompiledRefinedObj()
save = refobj.CreateParamSet("save")
refobj.EraseAllParamSet()
self.assertRaises(ObjCrystException, refobj.SaveParamSet, save)

def test_lsq_set_pr_fixed(self):
"""Check Creating a basic LSQ object & get obs&calc arrays."""
lsq = LSQ()
Expand Down
Loading