Convert inp file to code

I’m curious if there is a quick way to convert an input file to a GravityDriver_Inv like the .inp file in this example: http://docs.simpeg.xyz/content/examples/04-grav/plot_laguna_del_maule_inversion.html

I imagine this is definitely possible and have started by reading the topo and mesh files, but how do I set all the other properties programmatically?

FILE LdM_mesh.mesh					! Mesh file
FILE LdM_grav_obs.grv			! Obsfile
TOPO LdM_topo.topo					! TOPO Topofilename !or! FILE Activecellfilename. ! 0 = air, inactive, 1 = dynamic, -1 = static.
VALUE 1E-4			! Starting model | VALUE 1E-4
VALUE 0.0			! Reference model
DEFAULT				! Cell based weight file
VALUE 1				! target chi factor | DEFAULT=1
VALUE 1 1 1 1			! alpha s, x ,y ,z
VALUE -0.6 0.3		! Lower and Upper Bounds for p-component in g/cc
VALUE 0 1 1 1 2		! lp-norm for amplitude inversion FILE pqxqyqzr.dat  ! Norms VALUE p, qx, qy, qz, r | FILE m-by-5 matrix
DEFAULT		! Threshold value for the norm on model and model gradient VALUE eps_p, eps_q | DEFAULT

Normally, you could do:

import SimPEG.PF as PF
driver = PF.GravityDriver.GravityDriver_Inv(input_file)

but what if I want to do the same thing with code and not have the file?:

import discretize
driver = PF.GravityDriver.GravityDriver_Inv()
driver._mesh = discretize.TensorMesh.readUBC("LdM_mesh.mesh")
... # but what about all the other properties?

Update, from digging around in the source code, I found that .inp files are defined as:

# Line 1: Mesh
# Line 2: Observation file
# Line 3: Topo, active-dyn, active-static
# Line 4: Starting model
# Line 5: Reference model
# Line 6: Cell weights
# Line 7: Target chi-factor
# Line 8: Alpha values
# Line 9: Bounds
# Line 10: Norms
# Line 11: Treshold values

Using this, I was able to set all the properties programmatically

Thanks @banesullivan, this is a question that would be great to iterate on a bit within SimPEG. Dom has done a lot of work setting up drivers for the PF codes, and @sgkang09 has implemented some similar functionality in DC / IP.

It would be nice to abstract some of this so we can use these ideas across SimPEG both for programatically creating it (e.g. a higher-level API for SimPEG) and / or using an input file (which is much more familiar to folks who are used to working from a command-line).

We started talking about some naming ideas here: https://github.com/simpeg/simpeg/issues/801. Any suggestions you have both on the naming and on the structure would be appreciated!