- Wed 11 September 2013
- notebook
- Jason K. Moore
- #notebook, #python, #bibtex, #bmd2013, #human body model, #cython, #c
Today's task list:
- [x] Work on BMD papers
- [x] Do CITI course
- [] Work on parsing the walking data
- [] Book hotel for BMD
- [] Post update about BMD copyright
- [] Finish reading the van der Kooij paper
- [] See if our controller can drive an OpenSim model or Ton's 2D model
- [x] Wrap the HBM C code
- [] Duplicate website backups on a S3 bucket
- [] Work on the website theme
- [] Make generic settings on the lab website
- [] Review the TODO items on the Yeadon paper
- [] Do FERPA course
- [] Write up database proposal
- [] Try out CSympy with some mechanics problems
- [] Email Mounir about teaching
GSoC
Here is a video of the simulation Tarun's been working on as the main example for pydy-viz:
It looks pretty good. Deriving the model, generating python functions to numerically evaluated the EoMs, and then simulating is slow, but that wasn't really part of his project. We'll be speeding that up soon and maybe we can even write an ode solver in Javascript so we can do real time simulation and change the parameters on the fly.
BMD
I made some progress on the Whipple ID paper, basically just trimming my thesis. I also got my bibliography in order and looked into BibLaTeX and biber which are modern versions of bibtex, but didn't get them working. I have a main .bib database I have all my bicycle/motorcycle papers in which is about 800 entries at the moment. I wrote a simple script that scans my tex document for cite{} calls and then pulls those entries from the main .bib file and generates a local file with only the entries for the paper. That way I can maintain the info in the main database but ship the exact, smaller bib file with the paper. This allows the bib file to reflect the state it was in when the paper was last built and doesn't have entries that aren't used, yet allows me to maintain the main bib file for longevity. The script:
#!/usr/bin/env python # -*- coding: utf-8 -*- """This command line script allows you to extract the bibliographic entries from a bibtex bib file based on the unique citations in a TeX/LaTeX file. I keep all of my biblio information in a single database (bib file), but desire to have a small bib file to include with the paper I'm writing. So this script: - scans the tex file for the unique citation keys (only works with \cite{AuthYear}) - gets the keys from the main bib file - generates a new bib file with only the entries that are cited in the tex file You use it like this: python generate_sub_bib.py paper.tex main.bib sub_bib.bib It requires the pybtex program: pip install pybtex """ # standard library import re # external libraries from pybtex.database import BibliographyData from pybtex.database.input import bibtex as input_bibtex from pybtex.database.output import bibtex as output_bibtex class SubBib(object): def __init__(self, path_to_tex, path_to_main, path_to_sub): self.path_to_tex = path_to_tex self.path_to_main = path_to_main self.path_to_sub = path_to_sub self.extract_unique_bibkeys() self.load_main_file() self.build_new_file() def extract_unique_bibkeys(self): with open(self.path_to_tex, 'r') as f: tex_text = f.read() self.unique_bibtex_keys = \ list(set(re.findall(r'\\cite\{([a-zA-Z]*\d{4})\}', tex_text))) def load_main_file(self): parser = input_bibtex.Parser() self.main_bib_data = parser.parse_file(self.path_to_main) def build_new_file(self): new_entries = {} for key in self.main_bib_data.entries.keys(): if key in self.unique_bibtex_keys: new_entries[key] = self.main_bib_data.entries[key] database = BibliographyData(entries=new_entries) writer = output_bibtex.Writer() writer.write_file(database, self.path_to_sub) if __name__ == "__main__": import argparse parser = argparse.ArgumentParser( description='Generate a sub bib file.') # python generate_sub_bib.py paper.tex main.bib subbib.tex parser.add_argument('paper', type=str, help="The tex file to find the citations.") parser.add_argument('mainbib', type=str, help="The main file.") parser.add_argument('subbib', type=str, help="The new subfile.") args = parser.parse_args() creator = SubBib(args.paper, args.mainbib, args.subbib)
I'll push this to a repo or gist on Github at some point.
Human Body Model
I got the basics of a Cython wrapper for Ton's human body model C code in place, but I can't test it out until I get more than the C header file. I used these two references: