From 1165c0d38acf0c27285bc02cd0595073fe36dab5 Mon Sep 17 00:00:00 2001 From: Emily Veenhuis Date: Wed, 16 Feb 2022 12:51:40 -0500 Subject: [PATCH 1/6] Get build working --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 63d7983..5217462 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# TODO: Update with 4.x base image FROM kitware/pulse:3.0.1 ################################################################################ @@ -37,9 +38,7 @@ RUN mv /pulse/bin/substances/ ${HOME}/data/ RUN mv /pulse/bin/*.json ${HOME}/data RUN mv /pulse/bin/PyPulse* ${HOME} # Copy pulse python files to ${HOME} -RUN mkdir ${HOME}/python -RUN mv /source/src/python/google/ ${HOME}/python/ -RUN mv /source/src/python/pulse/ ${HOME}/python/ +RUN mv /pulse/python/ ${HOME}/python/ ENV PYTHONPATH ${HOME}:${HOME}/python # Change ownership to the binder runner USER root -- GitLab From e809dac64e14be9d5a486ba2b87e4ff40e51442c Mon Sep 17 00:00:00 2001 From: Emily Veenhuis Date: Wed, 16 Feb 2022 12:52:10 -0500 Subject: [PATCH 2/6] Update HowTo_EngineUse for Pulse 4.x --- HowTo_EngineUse.ipynb | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/HowTo_EngineUse.ipynb b/HowTo_EngineUse.ipynb index 034e40c..4a91894 100644 --- a/HowTo_EngineUse.ipynb +++ b/HowTo_EngineUse.ipynb @@ -27,7 +27,7 @@ "\n", "### Items of Note\n", "\n", - "#### PulsePhysiologyEngine\n", + "#### PulseEngine\n", "Creating an object of this time will allocate a new Pulse Engine in C++.\n", "This Python object manages, controls and exchanges data between Python and the C++ Pulse engine. \n", " \n", @@ -78,21 +78,23 @@ } ], "source": [ - "from pulse.cpm.PulsePhysiologyEngine import PulsePhysiologyEngine\n", + "from pulse.engine.PulseEngine import PulseEngine\n", "from pulse.cdm.engine import SEDataRequest, SEDataRequestManager\n", + "from pulse.cdm.scalars import ElectricPotentialUnit, FrequencyUnit, LengthUnit, MassUnit, MassPerVolumeUnit, \\\n", + " PressureUnit, TemperatureUnit, TimeUnit, VolumeUnit, VolumePerTimeUnit\n", "\n", "# Allocate a new C++ engine\n", - "pulse = PulsePhysiologyEngine()\n", + "pulse = PulseEngine()\n", "\n", "# The data we want to get back from the engine\n", "data_req_mgr = SEDataRequestManager([])\n", "data_requests = [\n", - " SEDataRequest.create_physiology_request(\"HeartRate\", unit=\"1/min\"),\n", - " SEDataRequest.create_physiology_request(\"RespirationRate\", unit=\"1/min\"),\n", - " SEDataRequest.create_physiology_request(\"EndTidalCarbonDioxidePressure\", unit=\"mmHg\"),\n", - " SEDataRequest.create_gas_compartment_substance_request(\"Carina\", \"CarbonDioxide\", \"PartialPressure\", unit=\"mmHg\"),\n", - " SEDataRequest.create_substance_request(\"Oxygen\", \"AlveolarTransfer\", \"mL/s\"),\n", - " SEDataRequest.create_substance_request(\"CarbonDioxide\", \"AlveolarTransfer\", \"mL/s\"),\n", + " SEDataRequest.create_physiology_request(\"HeartRate\", unit=FrequencyUnit.Per_min),\n", + " SEDataRequest.create_physiology_request(\"RespirationRate\", unit=FrequencyUnit.Per_min),\n", + " SEDataRequest.create_physiology_request(\"EndTidalCarbonDioxidePressure\", unit=PressureUnit.mmHg),\n", + " SEDataRequest.create_gas_compartment_substance_request(\"Carina\", \"CarbonDioxide\", \"PartialPressure\", unit=PressureUnit.mmHg),\n", + " SEDataRequest.create_substance_request(\"Oxygen\", \"AlveolarTransfer\", VolumePerTimeUnit.mL_Per_s),\n", + " SEDataRequest.create_substance_request(\"CarbonDioxide\", \"AlveolarTransfer\", VolumePerTimeUnit.mL_Per_s),\n", "]\n", "data_req_mgr = SEDataRequestManager(data_requests)\n", "data_req_mgr.set_results_filename(\"./test_results/UseCase1.csv\")\n", @@ -120,7 +122,7 @@ "\n", "The ```process_action()``` function is used to pass an Action object to the engine for processing. The next cell demonstrates the creation of an AirwayObstruction action for the patient. This action will occour for the patient until another is sent which stops it.\n", "\n", - "For a list all actions Pulse supports, see: https://pulse.kitware.com/physeng.html#ProcessActions#ProcessActions\n", + "For a list all actions Pulse supports, see: https://pulse.kitware.com/physeng.html#ProcessActions\n", "\n", "#### advance_time_s\n", "\n", @@ -289,12 +291,12 @@ "# The data we want to get back from the engine\n", "data_req_mgr = SEDataRequestManager([])\n", "data_requests = [\n", - " SEDataRequest.create_physiology_request(\"HeartRate\", unit=\"1/min\"),\n", - " SEDataRequest.create_physiology_request(\"RespirationRate\", unit=\"1/min\"),\n", - " SEDataRequest.create_physiology_request(\"EndTidalCarbonDioxidePressure\", unit=\"mmHg\"),\n", - " SEDataRequest.create_gas_compartment_substance_request(\"Carina\", \"CarbonDioxide\", \"PartialPressure\", unit=\"mmHg\"),\n", - " SEDataRequest.create_substance_request(\"Oxygen\", \"AlveolarTransfer\", \"mL/s\"),\n", - " SEDataRequest.create_substance_request(\"CarbonDioxide\", \"AlveolarTransfer\", \"mL/s\"),\n", + " SEDataRequest.create_physiology_request(\"HeartRate\", unit=FrequencyUnit.Per_min),\n", + " SEDataRequest.create_physiology_request(\"RespirationRate\", unit=FrequencyUnit.Per_min),\n", + " SEDataRequest.create_physiology_request(\"EndTidalCarbonDioxidePressure\", unit=PressureUnit.mmHg),\n", + " SEDataRequest.create_gas_compartment_substance_request(\"Carina\", \"CarbonDioxide\", \"PartialPressure\", unit=PressureUnit.mmHg),\n", + " SEDataRequest.create_substance_request(\"Oxygen\", \"AlveolarTransfer\", VolumePerTimeUnit.mL_Per_s),\n", + " SEDataRequest.create_substance_request(\"CarbonDioxide\", \"AlveolarTransfer\", VolumePerTimeUnit.mL_Per_s),\n", "]\n", "data_req_mgr = SEDataRequestManager(data_requests)\n", "data_req_mgr.set_results_filename(\"./test_results/UseCase1.csv\")\n", @@ -376,7 +378,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.4" + "version": "3.6.9" } }, "nbformat": 4, -- GitLab From 33783c26b42a87cca3b209d81b4daf2499082a6f Mon Sep 17 00:00:00 2001 From: Emily Veenhuis Date: Wed, 16 Feb 2022 13:00:46 -0500 Subject: [PATCH 3/6] Update HowTo_EngineUse for Pulse 4.x --- HowTo_EngineUse.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HowTo_EngineUse.ipynb b/HowTo_EngineUse.ipynb index 4a91894..d33d779 100644 --- a/HowTo_EngineUse.ipynb +++ b/HowTo_EngineUse.ipynb @@ -286,7 +286,7 @@ "from pulse.cdm.scalars import FrequencyUnit, LengthUnit, MassUnit, MassPerVolumeUnit, \\\n", " PressureUnit, TemperatureUnit, TimeUnit\n", "\n", - "pulse = PulsePhysiologyEngine()\n", + "pulse = PulseEngine()\n", "\n", "# The data we want to get back from the engine\n", "data_req_mgr = SEDataRequestManager([])\n", -- GitLab From c262b8f6f945b1771ab92f05f9bc03c36c1916aa Mon Sep 17 00:00:00 2001 From: Emily Veenhuis Date: Wed, 16 Feb 2022 14:08:55 -0500 Subject: [PATCH 4/6] fix multiplex ventilation for pulse 4.x --- Multiplex_Ventilation.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Multiplex_Ventilation.py b/Multiplex_Ventilation.py index 6a50859..4c59e13 100644 --- a/Multiplex_Ventilation.py +++ b/Multiplex_Ventilation.py @@ -4,7 +4,8 @@ import threading import numpy as np import bqplot as bq -from pulse.cdm.mechanical_ventilator import eConnection, eDriverWaveform +from pulse.cdm.engine import eSwitch +from pulse.cdm.mechanical_ventilator import eDriverWaveform from pulse.cdm.mechanical_ventilator_actions import SEMechanicalVentilatorConfiguration from pulse.cdm.scalars import FrequencyUnit, PressureUnit, TimeUnit from pulse.study.multiplex_ventilation.engine import MVEngine @@ -54,7 +55,7 @@ class MVSimExplorer(object): self.plots["AirwayPressure_cmH2O"] = PlotData() self.plots["ArterialCarbonDioxidePartialPressure_mmHg"] = PlotData() self.plots["ArterialOxygenPartialPressure_mmHg"] = PlotData() - self.plots["CarricoIndex_mmHg"] = PlotData() + self.plots["HorowitzIndex_mmHg"] = PlotData() self.plots["EndTidalCarbonDioxidePressure_mmHg"] = PlotData() self.plots["MeanAirwayPressure_cmH2O"] = PlotData() self.plots["OxygenationIndex"] = PlotData() @@ -103,8 +104,8 @@ class MVSimExplorer(object): self.update_ventilator = False self.ventilator = SEMechanicalVentilatorConfiguration() - self.v_cfg = self.ventilator.get_configuration() - self.v_cfg.set_connection(eConnection.Tube) + self.v_cfg = self.ventilator.get_settings() + self.v_cfg.set_connection(eSwitch.On) self.v_cfg.set_inspiration_waveform(eDriverWaveform.Square); self.v_cfg.set_expiration_waveform(eDriverWaveform.Square); @@ -486,7 +487,7 @@ class MVSimExplorer(object): self.plots["AirwayPressure_cmH2O"].update(p0.AirwayPressure_cmH2O,p1.AirwayPressure_cmH2O) self.plots["ArterialCarbonDioxidePartialPressure_mmHg"].update(p0.ArterialCarbonDioxidePartialPressure_mmHg,p1.ArterialCarbonDioxidePartialPressure_mmHg) self.plots["ArterialOxygenPartialPressure_mmHg"].update(p0.ArterialOxygenPartialPressure_mmHg,p1.ArterialOxygenPartialPressure_mmHg) - self.plots["CarricoIndex_mmHg"].update(p0.CarricoIndex_mmHg,p1.CarricoIndex_mmHg) + self.plots["HorowitzIndex_mmHg"].update(p0.HorowitzIndex_mmHg,p1.HorowitzIndex_mmHg) self.plots["EndTidalCarbonDioxidePressure_mmHg"].update(p0.EndTidalCarbonDioxidePressure_mmHg,p1.EndTidalCarbonDioxidePressure_mmHg) self.plots["MeanAirwayPressure_cmH2O"].update(p0.MeanAirwayPressure_cmH2O,p1.MeanAirwayPressure_cmH2O) self.plots["OxygenationIndex"].update(p0.OxygenationIndex,p1.OxygenationIndex) -- GitLab From c82d3199fc45d06695d717f3255636c9511f7fce Mon Sep 17 00:00:00 2001 From: Emily Veenhuis Date: Tue, 22 Feb 2022 14:24:49 -0500 Subject: [PATCH 5/6] move Jupyter requirements from base image --- Dockerfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5217462..530220a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ # TODO: Update with 4.x base image -FROM kitware/pulse:3.0.1 +FROM kitware/pulse:d7655177 ################################################################################ # install some python packages -#RUN pip3 install - +COPY requirements.txt /tmp/ +RUN pip3 install --requirement /tmp/requirements.txt +RUN jupyter nbextension enable --py bqplot ################################################################################ # set up user -- GitLab From 96241db590ebf2f84bf1b07d603852c56e29b149 Mon Sep 17 00:00:00 2001 From: Emily Veenhuis Date: Tue, 22 Feb 2022 14:47:54 -0500 Subject: [PATCH 6/6] update base image --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 530220a..9c39deb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -# TODO: Update with 4.x base image -FROM kitware/pulse:d7655177 +FROM kitware/pulse:4.1.0 ################################################################################ # install some python packages -- GitLab