Question on using the SurfSrc class from PyNE to read the MCNP wssa file.

58 views
Skip to first unread message

nash deng

unread,
Jan 27, 2021, 3:36:14 AM1/27/21
to PyNE Users

Dear pyNE team,

I would like to using the SurfSrc class from PyNE (link: http://pyne.io/pyapi/mcnp.html#pyne.mcnp.SurfSrc) to read the MCNP wssa file.

And I have installed pyne-0.7.0_ubuntu-20.04 in VMware.

I followed the instructions on the website and ran the following lines of code( from pyne import mcnp, pyne.mcnp.SurfSrc(wssa, rb) ), but an error was NameError: name 'pyne' is not defined (see screenshot).

How to solve this problem?

Best wishes,
nashdeng1.jpg 

nash deng

unread,
Jan 27, 2021, 3:43:10 AM1/27/21
to pyne-...@googlegroups.com

Paul Wilson

unread,
Jan 27, 2021, 7:57:21 AM1/27/21
to pyne-...@googlegroups.com

Hello,

It looks like you might not be calling the method correctly.

Since you have imported `mcnp` from pyne already, you should call it with

mcnp.SurfSrc

instead of

pyne.mcnp.SurfSrc

That is, you have not imported `pyne` but only imported the `mcnp` class from PyNe.

Paul

--
You received this message because you are subscribed to the Google Groups "PyNE Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyne-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyne-users/CAG-wuxronxvuX0xAErmXO0UZUr1qqZwhKNdbsQQrm1qJeZifrg%40mail.gmail.com.
--
-- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ --
Paul P.H. Wilson (he/him/his)
Grainger Professor of Nuclear Engineering
Chair, Department of Engineering Physics
o: 608-263-0807, c: 608-469-9615
paul....@wisc.edu
153 Engineering Research Bldg
1500 Engineering Dr, Madison, WI 53706
Zoom Meeting Room: https://uwmadison.zoom.us/j/6082630807
Zoom Phone Access: +1-929-205-6099, Access code: 6082630807

Computational Nuclear Engineering Research Group

nash deng

unread,
Jan 27, 2021, 9:30:03 AM1/27/21
to PyNE Users
Dear  Paul Wilson  ,

Thank you very much for your selfless teaching.  

According to your opinion, I use  mcnp.SurfSrc(wssa, rb ) to run, but it  report a NameError: name 'wssa' is not defined.

And I tried to use mcnp.SurfSrc(/home/pyne-user/Downloads/wssa,rb)  to run, but it  report a SyntaxError: invalid syntax(see screenshot).
捕获.JPG

How to solve this problem?

Best wishes,

nashdeng

Alex Malins

unread,
Jan 27, 2021, 7:35:23 PM1/27/21
to PyNE Users
Hi nashdeng,

You need to supply strings to the method:

mcnp.SurfSrc('wssa', 'rb')
or mcnp.SurfSrc('/home/pyne-user/Downloads/wssa', 'rb')

You can use the PyNE API manual to check what data types you should be supplying to methods and functions. E.g. For https://pyne.io/pyapi/mcnp.html#pyne.mcnp.SurfSrc for mcnp.SurfSrc().

Best wishes,
Alex

nash deng

unread,
Jan 28, 2021, 11:23:25 AM1/28/21
to PyNE Users

Dear  Alex Malins ,

Thank you very much for your selfless teaching.  

According to your opinion, I use mcnp.SurfSrc('wssa','rb') to run, it report <pyne.mcnp.SurfSrc object at 0x7fa18c9aee80>.

And I tried to use mcnp.SurfSrc('/home/pyne-user/Downloads/wssa','rb')  to run, it  report <pyne.mcnp.SurfSrc object at 0x7fa18c9c7a00>(see screenshot).

Does this indicate a successful operation?

If the wssa file has been successfully read, where is the generated file?r how to export files processed by pyne?

Best wishes,

nashdeng

1.JPG

Paul Wilson

unread,
Jan 28, 2021, 6:26:21 PM1/28/21
to nashde...@gmail.com, PyNE Users

Hello again,

It does look like you have correctly opened/read the WSSA file.  All the data from the file is loaded into the computer for further manipulation.

It is unclear what you actually want to do with the WSSA file, so it is hard to know what additional suggestions to make.

There is a script that shows how to combine multiple WSSA files into one: https://github.com/pyne/pyne/blob/develop/scripts/ssw_combine.py

Perhaps that can help you understand how to accomplish your goals.

Regards,

Paul

nash deng

unread,
Jan 28, 2021, 11:10:04 PM1/28/21
to PyNE Users

Dear  Paul Wilson  ,

Thank you very much for your selfless teaching.  

I want to use openmc(version 0.12.0)program to read the external source sampling wssa file generated by the MCNPX.

The developer of the openmc program recommended me to use the SurfSrc class from PyNE to read the MCNP wssa file and then use openmc.write_source_file to create a source file that OpenMC could read.

Could the ssw_combine.py achieve this function?

Or is there any other way to  achieve this function?

Best wishes,

nashdeng

nash deng

unread,
Jan 31, 2021, 8:14:52 PM1/31/21
to PyNE Users

Dear  Paul Wilson  ,

Thank you very much for your selfless teaching.  

I want to use openmc(version 0.12.0)program to read the external source sampling wssa file generated by the MCNPX.

The developer of the openmc program recommended me to use the SurfSrc class from PyNE to read the MCNP wssa file and then use openmc.write_source_file to create a source file that OpenMC could read.

Could the ssw_combine.py achieve this function?

Or is there any other way to  achieve this function?

Best wishes,

nashdeng

在2021年1月29日星期五 UTC+8 上午7:26:21<Paul Wilson> 写道:

Paul Wilson

unread,
Jan 31, 2021, 9:25:07 PM1/31/21
to nashde...@gmail.com, PyNE Users

Hello again,

No - the file I indicated will not do exactly what you want.

I think the advice from the OpenMC team was that you could write your own Python script to accomplish this.  It will require you to do the following steps:

  1. read the wssa file using the PyNE SurfSrc class (provided by PyNE)
  2. translate the data from the forms/formats used by PyNE.SurfSrc to those used by OpenMC (this is new - you would need to write this)
  3. write a source file using openmc.write_source_file (provided by OpenMC)

In summary, nothing exists already (that I know of) to do exactly what you want, but the combination of PyNE and openmc tools should make it easier for you to accomplish this without worrying too much about the file formats.

If/when you do complete this, we would gratefully accept it as a contribution to PyNE.

Paul

nash deng

unread,
Jan 31, 2021, 10:55:19 PM1/31/21
to PyNE Users

Dear Paul Wilson  ,

Thank you very much for your selfless teaching.  

I will try it with your suggestions, thank you again .

Best wishes,

nashdeng

Reply all
Reply to author
Forward
0 new messages