Giter Site home page Giter Site logo

dfnosorio / gemusexmlreader Goto Github PK

View Code? Open in Web Editor NEW
16.0 5.0 9.0 14 KB

Python class for reading GE MUSE XML files. Returns a header with most of the file configurations and the lead's data is available as a Numpy array or a Pandas data frame.

Python 100.00%
ge ecg-signal ge-muse-xml ge-muse

gemusexmlreader's Introduction

GEMuseXMLReader

     Python class for reading GE® MUSE® XML files. Returns a header with most of the file configurations and the lead's data is available as a Numpy array or a Pandas data frame.

Dependencies

     This reader needs the following libraries to parse the XML files:

  • xmltodict (To read and create a dictionary from the XML file)
  • numpy (To save the data from the leads into an array)
  • pandas (To save the data from the leads into a structured data frame)
  • xlwt (To save the lead data in a Excel file)

Usage

     The GEMuseXMLReader can be used in two different approaches:

  • as a converter
  • as a python class for accessing the data

     Converting XML file

     The GEMuseXMLReader can be called in the command line to convert the XML into a CSV, JSON, Excel, Numpy object, or all. Paired with the converted file is a JSON with the header information.

python3 GEMuseXMLReader.py 'filename.XML' [arguments]

               Arguments

  • [-csv [CSV]] - Convert the XML to a CSV. Output filename is optional.
  • [-pcsv [PCSV]] - Convert the XML to a CSV (Pandas formated). Output filename is optional.
  • [-ops [OPS]] - Convert the XML to a txt compatible with PLUX's opensignals. Output filename is optional.
  • [-x [EXCEL]] - Convert the XML to a Excel. Output filename is optional.
  • [-np [NUMPY]] - Convert the XML to a Numpy. Output filename is optional.
  • [-json [JSON]] - Convert the XML to a JSON. Output filename is optional.
  • [-all [ALL]] - Convert the XML to a CSV, Excel, Numpy and JSON. Output filename is optional.

     Python class

     The GEMuseXMLReader can be also be imported by another python script and used to converted the XML files, providing the data in either a Numpy array or a Panda data frame.

import GEMuseXMLReader

GEMuseData = GEMuseXMLReader('filename.XML')

GEMuseData.header ## Header containing the patient, device and acquisition session parameters

GEMuseData.dataObject ## Dictionary containing the data separated by lead

GEMuseData.dataFrame ## Panda's data frame containg the acquisition data

GEMuseData.dataArray ## Numpy matrix containing the acquisition data

Header

     The header is structured as follows:

  • Header

    • PatientInfo

      • Given_Name
      • Family_Name
      • ID
      • Gender
      • Race
      • Pacemaker
    • DeviceInfo

      • DeviceModel
      • DeviceName
      • DeviceSerial
    • AcquisitionInfo

      • AcquisitionDate
      • LeadAmplitudeUnitsPerBit
      • LeadAmplitudeUnits
      • Resolution
      • Filters
        • HighPass
        • LowPass
        • Algorithms*
          • Name
          • Purpose
      • SampleRate
      • LeadsInformation
        • LeadsNames
        • LeadsLabels
        • NumberOfSamples
      • HeaderString
  • Could be more than one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.