*************** Getting Started *************** .. _working-with-grid: Working with the grid ^^^^^^^^^^^^^^^^^^^^^ After successful creation of an HDF5 Grid (please see :ref:`io` for details) one can load the grid using:: >>> from starkit.gridkit import load_grid >>> grid = load_grid('mygrid.h5') >>> grid The values for `teff`, `logg` and `mh` are the defaults for the grid, but have no other special meaning and can be changed. StarKit heavily uses astropy.modeling please refer to its `reference guide `_. One can then just evaluate the grid at a certain parameter point:: >>> grid.teff = 5780. >>> grid.logg = 4.4 >>> grid.mh = 0.0 >>> wave, flux = grid() >>> plot(wave, flux) To change the grid parameters interactively and plot the resulting spectrum, you can use the example notebook: :doc:`/examples/interactive_spectrum`. StarKit works with a so called plugin-architecture that can modify the generated spectrum. For example, one can use the doppler shift plugin:: >>> from starkit.base.operations.stellar import DopplerShift, RotationalBroadening >>> doppler = DopplerShift(vrad=0) >>> doppler.vrad = 20 >>> new_wave, new_flux = doppler(wave, flux) These plugins can then be concatenated (again see `reference guide `_):: >>> my_model = grid | doppler >>> my_model You can then add further plugins to the model:: >>> from starkit.base.operations.stellar import RotationalBroadening, CCM89Extinction >>> rotation = RotationalBroadening.from_grid(grid, vrot=200) # it is imperative to load from_grid here as it needs to >>> extinction = CCM89Extinction(a_v=1.0, r_v=3.1) >>> my_model = grid | rotation | doppler | extinction >>> my_model >>> my_model.param_names (u'teff_0', u'logg_0', u'mh_0', u'alpha_0', u'vrot_1', u'limb_darkening_1', u'vrad_2', u'a_v_3', u'r_v_3') >>> my_model.vrot_1 = 300 There is a convenience function to assemble models:: >>> from starkit import assemble_model >>> my_model = assemble_model(grid, vrad=20, a_v=0.3, vrot=300) >>> my_model.__class__ Name: CompoundModel5 Inputs: () Outputs: ('wavelength', 'flux') Fittable parameters: (u'teff_0', u'logg_0', u'mh_0', u'alpha_0', u'vrot_1', u'limb_darkening_1', u'vrad_2', u'a_v_3', u'r_v_3') Expression: [0] | [1] | [2] | [3] Components: [0]: [1]: [2]: [3]: Working with grid and spectra ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The next step is to work with grid and spectra.