Skip to content

Adds wrapper for python and dylib custom function - #157

Merged
StephenNneji merged 3 commits into
RascalSoftware:masterfrom
StephenNneji:refactor_lib_manager
Sep 21, 2023
Merged

Adds wrapper for python and dylib custom function#157
StephenNneji merged 3 commits into
RascalSoftware:masterfrom
StephenNneji:refactor_lib_manager

Conversation

@StephenNneji

@StephenNnejiStephenNneji commented Aug 24, 2023

Copy link
Copy Markdown
Collaborator

This adds wrappers for python and dynamic library custom layer functions. The customFile interface will remain unchanged but the wrappers are used in the toStruct function.

@StephenNneji
StephenNnejiforce-pushed the refactor_lib_manager branch 4 times, most recently from 9bea78a to fbfe218CompareAugust 24, 2023 15:43
@StephenNneji

Copy link
Copy Markdown
CollaboratorAuthor

@arwelHughes have a look (you can run testCustomLanguages to try it out). I have question about customXY we can discuss later

Comment threadcompile/customWrapper/pythonWrapper.m Outdated
Comment threadcompile/customWrapper/pythonWrapper.m Outdated
Comment threadcompile/customWrapper/pythonWrapper.m Outdated
problem.setCustomFile(1,'language','python');
wrapper = pythonWrapper('customBilayer.py', 'customBilayer');
problem.setCustomFile(1,'filename', wrapper.getHandle());
problem.setCustomFile(1,'language','matlab');

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May need to consider changes to the custom file class in this case - should python be removed from the supported languages? do we need to change the fields that are currently defined?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the wrapper is python, but the specified language is matlab, that definitely isn't ideal.

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to remove the language option completely when its done

[thisContrastLayers,allRoughs(i)] = callCppFunc(params,bulkIn,bulkOut,i,thisFile,thisFile);
case 'python'
[thisContrastLayers,allRoughs(i)] = pythonCustomFunctionWrapper(thisFile,params,bulkIn,bulkOut,i,numberOfContrasts);
[thisContrastLayers, allRoughs(i)] = callCppFunc(params, bulkIn, bulkOut, i, -1, thisFile);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this routine cover both python and C++, may be worth considering renaming it.

@StephenNnejiStephenNnejiSep 4, 2023

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

callCppFunc only handles C++ while the callMatlabCustomFunction only runs matlab (the wrapper then calls python)

@StephenNneji
StephenNneji marked this pull request as ready for review September 13, 2023 10:47
Comment threadAPI/projectClass/customFileClass.m
Comment threadcompile/customWrapper/pyRunner.m
Comment threadcompile/makeCompileArgs.m
Comment threadtests/testCustomFileClass.m Outdated
Comment threadtests/testCustomFileClass.m Outdated
Comment threadAPI/parseClassToStructs.m Outdated
@StephenNneji
StephenNneji merged commit d171596 into RascalSoftware:masterSep 21, 2023
@DrPaulSharpDrPaulSharp mentioned this pull request Nov 15, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@StephenNneji@DrPaulSharp