Skip to content
This repository was archived by the owner on Jan 10, 2019. It is now read-only.
Open
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pybind11"]
path = pybind11
url = https://github.com/pybind/pybind11.git
22 changes: 22 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.1)

project(single_e)

# boost
find_package(Boost REQUIRED)

# python
find_package(PythonLibs REQUIRED)

# Pybind11
add_subdirectory(pybind11)

pybind11_add_module(single_e single_e.cpp)

target_link_libraries(single_e PRIVATE "${Boost_LIBRARIES}")
target_include_directories(single_e PRIVATE ${Boost_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})

add_custom_command(
TARGET single_e POST_BUILD VERBATIM
COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:single_e>" "${CMAKE_SOURCE_DIR}/isolver.so"
)
8 changes: 8 additions & 0 deletions model1.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@



E_0, T_0,I_0 = x.characteristic_val()
exp_data = np.loadtxt('HypD_9Hz_cv_current',skiprows=19)
exp_t = exp_data[:,0]/T_0
exp_I = exp_data[:,1]/I_0

plt.plot(exp_t,exp_I,label='data')
plt.plot(time,output,label='sim')
plt.show()

1 change: 1 addition & 0 deletions pybind11
Submodule pybind11 added at ce9d6e
18 changes: 9 additions & 9 deletions python_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def non_dim_capacative(self,parameters):
self.E_reverse=self.E_reverse/self.E_0
self.dE=self.dE/self.E_0
return parameters


def times(self):
final_time=(self.E_reverse-self.E_start)*2
Expand All @@ -57,14 +57,14 @@ def simulate(self, parameters, time):
#Parameters 1-4= Cdl, Cdl1, Cdl2, Cdl3, omega
output=isolver.I_tot_solver(parameters[0], parameters[1], parameters[2], parameters[3], parameters[4],self.v, self.alpha, self.E_start, self.E_reverse, self.dE, self.Ru, self.E0_mean, self.k0_mean, self.E0_sigma, 1)
output=np.array(output)
final_time=(self.E_reverse-self.E_start)*2
time=np.linspace(0,final_time,len(output), dtype='double')
plt.plot(time,output)
plt.xlabel('time')
plt.ylabel('Itot')
plt.show()
##final_time=(self.E_reverse-self.E_start)*2
##time=np.linspace(0,final_time,len(output), dtype='double')
##plt.plot(time,output)
##plt.xlabel('time')
##plt.ylabel('Itot')
##plt.show()
return output




Loading