Plot empty lattice modes in lat2d_realfreqsvd.py
[qpms.git] / misc / riinfo2c.py
blobe6a0010298e46c1bd1184597eb48b4cfbb45be80
1 '''INCOMPLETE! This will read read the refractiveindex.info yaml files
2 and transforms the database into a C source.'''
4 import re
5 import os
6 try:
7 from yaml import CLoader as Loader, CDumper as Dumper
8 except ImportError:
9 from yaml import Loader, Dumper
11 # Right now, we can process only the 'tabulated nk' data
12 searchfor = '- type: tabulated nk'
13 searchfor = re.compile(searchfor)
15 ridatadir = "/u/46/necadam1/unix/repo/refractiveindex.info-database/database/data"
17 nktables = dict()
19 def find_files_by_pattern (pattern, dir):
20 r = re.compile(pattern)
21 for parent, dnames, fnames in os.walk(ridatadir):
22 for fname in fnames:
23 filename = os.path.join(parent, fname)
24 if os.path.isfile(filename):
25 with open(filename) as f:
26 text = f.read()
27 if r.search(text):
28 yield (