Designing a Flexible Mathematica Program for Data Analysis
- To: mathgroup at smc.vnet.net
- Subject: [mg74690] Designing a Flexible Mathematica Program for Data Analysis
- From: "5000brians" <5000brians at gmail.com>
- Date: Sat, 31 Mar 2007 01:37:12 -0500 (EST)
I'm using Mathematica to perform data analysis for a project I've been working on for a few years. I have written quite a bit of Mathematica code for automating the task of analyzing the data. As time goes by, the type of data I collect changes slightly. I'm looking for a way for the various data set types I have to happily coexist within a single Mathematica session so I can compare and contrast all the data with a minimum of fuss. Let's say I want to create a plot of dataset 1 and dataset 2. In both cases, I want the same thing, a plot of parameter a versus parameter b. And let's say I have a bunch of code already written and it works just fine for dataset 1. But, dataset 2 is newer, and the data format is slightly different. The parameters a and b mean the same thing in both cases, it's just that they are represented differently in dataset 2 than in dataset 1. And let's say I have the following functions: readDataset: opens the text file and puts dataset into memory generateAandB: based on the data in the dataset, creates a list of parameters a and b for a dataset plotAandB: creates a plot of a vs b. In this case, I probably need two versions of readDataset and generateAandB, one for each of my dataset types. If I am using a List[], I am probably ok with one plotAandB function. But how can I automate this solution? What if I want to read in 30 datasets with 10 different dataset types? I can't do plotAandB[generateAandB[readDataset[#]]]& /@ listOfDatasets, because I need 10 different generateAandBs and 10 different readDatasets. How can I make my code "datatype aware"? I know this is a bit long winded - sorry about that. Thanks for any help, Brian