Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorials are getting outdated #1476

Open
ahnaf-tahmid-chowdhury opened this issue Feb 24, 2023 · 6 comments · Fixed by #1486 · May be fixed by #1497
Open

Tutorials are getting outdated #1476

ahnaf-tahmid-chowdhury opened this issue Feb 24, 2023 · 6 comments · Fixed by #1486 · May be fixed by #1497

Comments

@ahnaf-tahmid-chowdhury
Copy link
Member

Recently, I have started playing with tutorials where I have found following errors.

tutorial/00-intro.ipynb

# plot the total cross section
SlicePlot(PyneMoabHex8Dataset(m), 'z', 'sigma_t', origin='native').display()
FileNotFoundError                         Traceback (most recent call last)
Cell In[5], line 21
     18 m.u_mass = mesh.ComputedTag(lambda mesh, i: max(mesh.mats[i]['U':'Np'].mass, 0.0))
     20 # plot the total cross section
---> 21 SlicePlot(PyneMoabHex8Dataset(m), 'z', 'sigma_t', origin='native').display()
     23 # print the total mass of uranium in the reactor mesh
     24 print("U Content of Mesh:", sum(m.u_mass[:]), "grams")

File /opt/nuclear-boy/lib/python3.10/site-packages/yt/data_objects/static_output.py:192, in Dataset.__new__(cls, filename, *args, **kwargs)
    188     is_stream = hasattr(filename, "get_fields") and hasattr(
    189         filename, "get_particle_type"
    190     )
    191     if not is_stream:
--> 192         obj.__init__(filename, *args, **kwargs)
    193     return obj
    194 apath = os.path.abspath(os.path.expanduser(filename))

File /opt/nuclear-boy/lib/python3.10/site-packages/yt/frontends/moab/data_structures.py:162, in PyneMoabHex8Dataset.__init__(self, pyne_mesh, dataset_type, storage_filename, units_override, unit_system)
    160 filename = f"pyne_mesh_{id(pyne_mesh)}"
    161 self.pyne_mesh = pyne_mesh
--> 162 Dataset.__init__(
    163     self,
    164     str(filename),
    165     dataset_type,
...
--> 315     retv = int(os.stat(self.parameter_filename)[ST_CTIME])
    316     name_as_bytes = bytearray(map(ord, self.parameter_filename))
    317     retv += fnv_hash(name_as_bytes)

FileNotFoundError: [Errno 2] No such file or directory: '/mnt/Data/Projects/PyNE/tutorial/pyne_mesh_140696287338000'

It seems like the code is trying to access a file that doesn't exist. The error message indicates that there is no such file or directory named 'pyne_mesh_140696287338000' which is not generating automatically.

tutorial/11-ensdf-processing.ipynb

input_dict = {}
input_dict['input_file'] = 'ensdf_processing/alphad/ref_a228.ens'
input_dict['report_file'] = '/alphad.rpt'
input_dict['rewrite_input_with_hinderance_factor'] = 1
input_dict['output_file'] = '/alphad.out'
output_dict = ensdf_processing.alphad(input_dict)
FileNotFoundError                         Traceback (most recent call last)
Cell In[6], line 5
      3 input_dict['rewrite_input_with_hinderance_factor'] = 1
      4 input_dict['output_file'] = '/alphad.out'
----> 5 output_dict = ensdf_processing.alphad(input_dict)

File /opt/nuclear-boy/lib/python3.10/site-packages/pyne/ensdf_processing.py:139, in alphad(inputdict_unchecked)
    137     output_file = inputdict_unchecked["output_file"]  # output file if report = yes
    138 exe_path = path_to_exe("alphad")
--> 139 proc = subprocess.Popen([exe_path], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
    140 inp = input_file + "\n" + report_file + "\n" + "Y" + "\n"
    141 if rewrite_hinderance == 1:

File /usr/lib/python3.10/subprocess.py:969, in Popen.__init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags, restore_signals, start_new_session, pass_fds, user, group, extra_groups, encoding, errors, text, umask, pipesize)
    965         if self.text_mode:
    966             self.stderr = io.TextIOWrapper(self.stderr,
    967                     encoding=encoding, errors=errors)
--> 969     self._execute_child(args, executable, preexec_fn, close_fds,
    970                         pass_fds, cwd, env,
    971                         startupinfo, creationflags, shell,
    972                         p2cread, p2cwrite,
    973                         c2pread, c2pwrite,
    974                         errread, errwrite,
    975                         restore_signals,
...
   1844         err_msg = os.strerror(errno_num)
-> 1845     raise child_exception_type(errno_num, err_msg, err_filename)
   1846 raise child_exception_type(err_msg)

FileNotFoundError: [Errno 2] No such file or directory: '/opt/nuclear-boy/lib/python3.10/site-packages/pyne/alphad'

The alphad function in ensdf_processing is calling a subprocess using subprocess.Popen and providing the path to the executable file, but it seems that the path is incorrect.

  • OS: Ubuntu 22.04
  • Python: 3.10.6
  • PyNE: dev
  • MOAB: 5.4.1
  • yt: 4.1
@welcome
Copy link

welcome bot commented Feb 24, 2023

Hi, and welcome to PyNE! 👋 Thanks for opening your first issue. We recommend that you include information such as the version of PyNE you're working with (eg, develop branch or a specific version), the platform you are operating on, the expected behavior, and the actual behavior you are bringing our attention to. The more deatil you provide, the better others in this community will be able to help you.

@gonuke
Copy link
Contributor

gonuke commented Jul 22, 2023

Some of this was addressed in #1486 - I'll let @ahnaf-tahmid-chowdhury decide whether to close this or elaborate for continued needs.

@ahnaf-tahmid-chowdhury
Copy link
Member Author

Dear @gonuke, I am considering closing this issue after reviewing 08-diffusion.ipynb and 11-ensdf-processing.ipynb.

@ahnaf-tahmid-chowdhury
Copy link
Member Author

ahnaf-tahmid-chowdhury commented Jul 23, 2023

While working with 08-diffusion.ipynb, I was getting an AttributeError: pymoab.core.Core object has no attribute getTagHandle. It seems that the latest version of pymoab has changed some methods.

This was linked to pull requests Aug 10, 2023
@ahnaf-tahmid-chowdhury
Copy link
Member Author

I have come to know that ENSDF project is nearing the end of a 3-year modernization effort. They've revamped the old ENSDF format into a more current JSON format and upgraded all associated tools. This includes a new Python-based API. More information is available here.

@gonuke
Copy link
Contributor

gonuke commented Aug 21, 2023

I think we're definitely going to want to plan to incorporate these improvements. Our ENSDF processing currently relies on legacy FORTRAN 77 and very little knowledge of the file format itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants