Skip to main content

export medpc data to excel file and generate user defined variables

Project description

medpc2excel

medpc2excel is a Python package for converting single or multiple medpc data files into Excels. medpc2excel can also return a pandas DataFrame for further analysis

Installation

I recommend installing an Anaconda distribution of Python. The current validation target is Python 3.12. Use the package manager pip to install medpc2excel. The current version is 4.0.0

pip install medpc2excel==4.0.0

To install directly from GitHub and bypass PyPI, run:

pip install "git+https://github.com/cyf203/medpc2excel.git"

If you downloaded or installed the latest version of Anaconda or Miniconda, you can create a conda environment in your cmd. To do so:

conda env create --name <envname> --file=environments.yml

If conda has problem to install dependencies, you can also run:

pip install -r requirements.txt

Version updating note

Version 4.0.0 updates the package for Python 3.12, current pandas/openpyxl behavior, and more resilient handling of malformed MED-PC chunks.

Configure *.MPC file

Please include a medpc protocol file (*.MPC) that you used for behavior task. The file name of this MPC file should be the same as that of the medpc data file. The medpc2excel will open the medpc data file and automatically search the used *.MPC file in the same directory. In *.MPC file, please explicitly declare each array as below:

<... your MPC code...>

    DIM C =9999  \ Levertype                     
    DIM D =9999  \ PelHLON                       
    DIM E =9999  \ PelHLOFF   
    
<... your MPC code ...>

Naming and formatting medpc data file

Please make sure medpc data file is a 'file' but not not a '*.txt' file. If so, just remove *.txt at the end Please make sure the data file's name starts with some number. I usually keep a time tag like: '20240904_xxx' But it can also be any number like: '2000_xxx'

Running medpc2excel

The quickest way to start is to open the GUi from a command line terminal in Anaconda cmd prompt:

python -m medpc2excel

After installing the package, you can also launch the GUI directly with:

medpc2excel

You can use the data explorer tab to see the raster of each event. alt text

You also can import this module and use the function called medpc_read as following

from medpc2excel.medpc_read import medpc_read

f = <file path>

ts_df, log = medpc_read(f, override = True, replace = False) # return a timestamp dataframe and a log string

Please download the Example folder to your local disk and run the medpc2excel_example.py to give a try.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

Dependencies

numpy==2.4.1
pandas==2.3.3
openpyxl==3.1.5
matplotlib==3.10.8
mplcursors==0.7.1
PyQt5==5.15.10

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

medpc2excel-4.0.0.tar.gz (18.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

medpc2excel-4.0.0-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file medpc2excel-4.0.0.tar.gz.

File metadata

  • Download URL: medpc2excel-4.0.0.tar.gz
  • Upload date:
  • Size: 18.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for medpc2excel-4.0.0.tar.gz
Algorithm Hash digest
SHA256 6b5c24d7d5d77836aaee783c86ebc20aaf5f3c1f008b7724ca3eded3cb70c770
MD5 9e8567a40f8e8818b446b80aa92b987f
BLAKE2b-256 a6c17cc1053a97e8f6c86b89afa953a6d58ae64bf3edcc3643b2f8981e36fb09

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpc2excel-4.0.0.tar.gz:

Publisher: publish-pypi.yml on cyf203/medpc2excel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file medpc2excel-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: medpc2excel-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for medpc2excel-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06790d0e61e8204f202940a27264abaeab7afa25b0c3ec38b4c5039c8ed42912
MD5 4a5717a6df39b6bcfb8e1393a949919f
BLAKE2b-256 01f2cfc1b977b90a72a1f4acda9bce42dee04e32220b028ba3491a10ed2b521f

See more details on using hashes here.

Provenance

The following attestation bundles were made for medpc2excel-4.0.0-py3-none-any.whl:

Publisher: publish-pypi.yml on cyf203/medpc2excel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page