Reading information on partions from PDG data (2008)
Code: "pdginfo.py". Programming language: Python DMelt Version 1. Last modified: 07/23/2017. License: Pro
https://datamelt.org/code/cache/pdginfo_873.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.



# -*- coding: utf-8 -*-

"""
Particle data from the PDG
"""

class Particle(object):
    """
    An elementary or composite particle
    """    
    def __init__(self, mass, masspositiveerror, massnegativeerror, width, widthpositiveerror, widthnegativeerror, isospin, gparity, totalspin, spaceparity, chargeconjugation, antiparticleflag, number, charge, rank, particlestatus, name, quarkcontent):
        self.number = number
        self.name = name
        self.mass = mass
        self.masspositiveerror = masspositiveerror
        self.massnegativeerror = massnegativeerror
        self.width = width
        self.widthpositiveerror = widthpositiveerror
        self.widthnegativeerror = widthnegativeerror
        self.isospin = isospin
        self.gparity = gparity
        self.totalspin = totalspin
        self.spaceparity = spaceparity
        self.chargeconjugation = chargeconjugation
        self.antiparticleflag = antiparticleflag
        self.charge = charge
        self.rank = rank
        self.particlestatus = particlestatus
        self.quarkcontent = quarkcontent
    def add_decay(self, decay):
        pass
    def __str__(self):
        return self.name+' : '+self.quarkcontent
    def __repr__(self):
        return ''

class Decay(object):
    def __init__(self):
        pass

http='http://datamelt.org/examples/data/'
file='mass_width_2008.csv'
print Web.get(http+file)
pdginfofile = open(file)
particles = []
for line in pdginfofile:
    if line[0] == '*':
        continue
    line = line.split(',')
    if len(line) != 18:
        continue
    line = [element.strip() for element in line]
    print line
    particle = Particle(line[0], line[1], line[2], line[3], line[4], line[5], line[6], line[7], line[8], line[9], line[10], line[11], line[12], line[13], line[14], line[15], line[16], line[17])
    particles.append(particle)

#for particle in particles: print particle
print particles


You see the box below because you did not login.