MCPcopy Create free account
hub / github.com/bab2min/tomotopy / tdf

Method tdf

src/python/handler/py_GDMR.cpp:174–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172}
173
174std::vector<float> GDMRModelObject::tdf(PyObject* numericMetadata, const std::string& metadata, PyObject* multiMetadata, bool normalize) const
175{
176 auto* inst = getInst<tomoto::IGDMRModel>();
177
178 vector<tomoto::Float> nmd;
179 if (!py::toCpp(numericMetadata, nmd))
180 {
181 throw py::ValueError{
182 "`numeric_metadata` must be an iterable of float (but given " + py::repr(numericMetadata) + ")"
183 };
184 }
185 if (nmd.size() != inst->getFs().size()) throw py::ValueError{ "`len(numeric_metadata)` must be equal to `len(degree).`" };
186
187 try
188 {
189 return inst->getTDF(nmd.data(), metadata, {}, normalize);
190 }
191 catch (const tomoto::exc::InvalidArgument& e)
192 {
193 throw py::ValueError{ e.what() };
194 }
195}
196
197py::UniqueObj GDMRModelObject::tdfLinspace(PyObject* numericMetadataStart, PyObject* numericMetadataEnd, PyObject* numericMetadataNum, const std::string& metadata, PyObject* multiMetadata, bool endpoint, bool normalize) const
198{

Callers

nothing calls this directly

Calls 5

toCppFunction · 0.85
reprFunction · 0.85
getTDFMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected