Main object¶
wig.wig object¶
-
class
wig.wig.wig(comment, filename, flavor=‘6’, render=True, particles=[‘n’])[source]¶ The
wigobject is the base object for an MCNP setup.The
wigobject is basically the scene in which we create our MCNP geometry, cells, materials, physics, tallies, and other data. I usually just call itsceneand use it from there.Parameters: - comment (str) – The comment that will be placed BELOW the first comment line of the MCNP deck.
- filename (str) – The filename (duh) of the input deck. ‘.inp’ will be automatically appended. The full path to this file will be the first line of the input file (i.e., the full path will be the first comment line of the deck)
- flavor (str) – ‘6’ for
mcnp6, ‘5’ formcnp5, ‘x’ formcnpx, or ‘polimi’ formcnpx-polimi. Make sure you alias the binaries to those commands or the runner wont work. - render (bool) – defines whether to render the scene using
blenderbefore running it - particles (list) – a list of
'n', 'p', ...for the particles we should care about
Returns: the
wigobject.-
set_filename(filename)[source]¶ set_filenamesets the base of the filenames that will be createdParameters: filename (str) – the base of the filename
-
set_comment(comment)[source]¶ set_commentwrites the first line of themcnpfile, which is a comment describing the file. Be descriptive but not too long.Parameters: comment (str) – the first line of the mcnpfile - limit is 80 characters.wigmanually strips newlines, so feel free to make this a triple quoted (''') string with as many returns as you like.
-
geo(geos=None)[source]¶ geoadds all definedwig.geoobjects to an input deckParameters: geos (list) – the wig.geoobjects to be added to the input deck. Make sure this includes a universe
-
cell(cells=None, auto_universe=True, universe_matl=None, debug_blender=False)[source]¶ celladds all thewig.cellin a list to an input deck.Parameters: - cells (list) – the list of
wig.cellto be added to the input deck. If you don’t have a cell named'universe', this method will make one for you, but you might night like it. - debug_blender (bool) – whether or not you want to see the
commands that will be sent to
blender, defaultFalse.
- cells (list) – the list of
-
matl(matls=None)[source]¶ matladds all thewig.matlto the input deckParameters: matls (list) – the materials to add to the input deck
-
phys(phys=None)[source]¶ physadds allwig.physblocks to the modelParameters: phys (wig.phys) – the wig.physblock to be added to the model.
-
tally(tallies=None)[source]¶ tallyadds allwig.tallyb’ocks to the modelParameters: tallies (list) – the wig.tallyblocks to be added to the model.
-
source(sources=None)[source]¶ sourceadds thewig.sourceobject to the modelParameters: sources (list) – the wig.sourceblocks (defining sources and distributions) to be added to the model.
-
run(remote=’local’, sys=’linux’, blocking=False, clean=False, **kwargs)[source]¶ run(of course) runs the deck.runfirst writes the input deck, including rendering with whatever additional keyword args you pass, and then opens an instance of awig.runner, and passes commands to it.Parameters: - remote (str) – The ip address of the remote system you want to
run this on, or
'local'if on this system. The remote system must be set for passwordless ssh login and havemcnpon path (whatever flavor you’re using). Default:'local' - sys (str) – The type of system that the remote runs on.
Currently, this is useless, as I’ve only made it run on linux.
Default:
'linux' - blocking (bool) – Whether to wait on the deck to finish running
before continuing or not. Useful to block if you want to run
many decks depending on the previous result (optimization), or
if you only have a certain number of processors. Default:
False - clean (bool) – Whether to clean up the running files in the
~/mcnp/activedirectory or not. Keep the files if storage isn’t a concern and you’re unsure if your deck will run correctly. Default:False - kwargs (dict) –
runpasses the rest of the commands towrite
- remote (str) – The ip address of the remote system you want to
run this on, or
-
write(**kwargs)[source]¶ writewrites the input deck and renders the input deckParameters: kwargs (dict) – keyword arguments to pass to render
-
render(filename_suffix=”, render_target=None, camera_location=None, render=True, **kwargs)[source]¶ renderpasses the input deck topyb, a simplified renderer that usesblenderas the backendParameters: - filename_suffix (str) – suffix to put after the filename when we
save the rendering. Default:
'' - render_target (tuple) – a point for the camera to look at when
rendering. Default:
(0, 0, 0) - camera_location (tuple) – a point from which the camera looks. Default: based on the size of the scene, isotropic placement.
- render (bool) – Whether or not to actually run the render. This
method will always save a blender file, regardless of if we do a
full render. Default:
True - kwargs (dict) – Other arguments to pass to
pyb.render. Seepybfor options, such assamplesorres.
- filename_suffix (str) – suffix to put after the filename when we
save the rendering. Default:
-
refresh_data()[source]¶ refresh_dataresets the data block to nothing. Useful if you’re reusing a model and want to reset sources or materials or something.
-
refresh_geo()[source]¶ refresh_georesets the geometry block to nothing. Useful if you’re changing geometry, although this probably shouldn’t be used without also refreshing the cells. But I don’t know you, live your life.
-
refresh_cell()[source]¶ refresh_cellresets the cell block to nothing. Again, useful for changing up cell definitions or materials.
-
refresh_phys()[source]¶ refresh_physresets the physics block to nothing. This is a subset of therefresh_datamethod, so use whichever one is more useful.
-
refresh_source()[source]¶ refresh_sourceresets the soruce block to nothing. This actually just calls refresh_data because the only thing in the data block right now is the sources.
-
refresh_tally()[source]¶ refresh_tallyresets the tally block to nothing. This is probably not useful, unless you’re changing other things, too. If the model is still the name, just add the all the tallies in one input file and run it, it’s faster that way.


