[FLASH-USERS] FLASH's python tools

Ong Jian Fuh jianfuh.ong at eli-np.ro
Mon Jun 7 02:29:07 EDT 2021


Dear Ryan,

Thanks for your suggestion. I looked into the python tool in 
/tools/python/output.py & yt_derived_fields.py/. I tried to import those 
files into my jupyter notebook. I find most of them is outdated (in 
FLASH4.6.2), even the /yt/ command such as /from 
yt.data_objects.field_info_container import add_field /does not exist 
anymore. Only part of the file is compatible with python3 (e.g. 
tools/scripts/extract_rays.py). I will try out yt for the plotting.

Regards,

Dr. Ong Jian Fuh
Extreme Light Infrastructure - Nuclear Physics
"Horia Hulubei" National Institute for Physics and Nuclear Engineering
30 Reactorului Street, 077125 Magurele (Ilfov), Romania
www.eli-np.ro

On 01/06/2021 6:08 pm, Ryan Farber wrote:
> Hi Jian,
>
> I'd recommend copy pasting the exact command you're using at the 
> command line, similar to how you've been copy-pasting the Traceback 
> error messages. I'd also recommend following the instructions in the 
> quickstart guide here: 
> http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node13.html 
> <http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node13.html> 
> (or for the corresponding version of FLASH you're using).
>
> The flmake documentation you linked to is from FLASH4 ***beta*** which 
> I would guess is around 10+ years old, so it's unsurprising to me that 
> it doesn't work with FLASH4.6+. The good news is plotting natively 
> with yt is simple enough, and the yt community is pretty helpful.
>
> Best,
> --------
> Ryan
>
>
> On Tue, Jun 1, 2021 at 2:04 AM Jian Fuh Ong <jianfuh.ong at eli-np.ro 
> <mailto:jianfuh.ong at eli-np.ro>> wrote:
>
>     Hi Ryan,
>
>     I just downloaded FLASH4.6 and
>     /python setup.py install/--///user/ return
>
>       File "setup.py", line 42
>       print "RELEASE file not found at " + release_path
>                                       ^
>     SyntaxError: Missing parentheses in call to 'print'. Did you mean
>     print("RELEASE file not found at " + release_path)?
>
>     The <> operator still appear in utils.py. I am not sure if this
>     python tool also changed to python3. Using python2.7 gives
>
>     Traceback (most recent call last):
>     File "setup.py", line 207, in <module>
>       run_setup()
>     File "setup.py", line 199, in run_setup
>       make_bash_completion()
>     File "setup.py", line 118, in make_bash_completion
>       import flash.flmake.__init__
>     ImportError: No module named flash.flmake.__init__
>     I see the flamake lines here.
>     http://flash.uchicago.edu/site/flashcode/user_support/tools4b/usersguide/output.html#
>     <http://flash.uchicago.edu/site/flashcode/user_support/tools4b/usersguide/output.html#>
>
>     All I need to do is to extract the data from hdf5 file for
>     plotting, i.e.
>
>     from flash import output import matplotlib.pyplot as plt x, y, z =
>     output.slice(2, 0.0, 'dens', "<path to chk>") plt.imshow(z) plt.show()
>
>
>     Regards,
>     Jian Fuh
>
>
>
>>     On 31 May 2021, at 7:14 PM, Ryan Farber <rjfarber at umich.edu
>>     <mailto:rjfarber at umich.edu>> wrote:
>>
>>     Hi Ong,
>>
>>     Unfortunately, I appear to have deleted my FLASH 4.6.2
>>     installation. I had thought it should be fine with python3
>>     but can't confirm at this time. However, the user guide suggests
>>     python3 compatibility since FLASH 4.6 as I had thought so perhaps
>>     there is some improper link for the download of FLASH 4.6.2
>>     pointing to an older version?
>>     http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node6.html
>>     <http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node6.html>
>>
>>     Regarding the flmake lines in the user guide, where do you see
>>     that? I haven't used that tool before. I don't see flmake
>>     referenced in the quickstart guide (just double-checked)
>>     http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node13.html
>>     <http://flash.uchicago.edu/site/flashcode/user_support/flash4_ug_4p62/node13.html>.
>>
>>     If you don't require FLASH 4.6.2 you can see if FLASH4.6 setup
>>     works with your python3 environment (there shouldn't be those
>>     diamond operators except in older version of FLASH). However, I'm
>>     pretty sure python 2.7 will work if you don't use flmake since
>>     the error you reported had to do with that tool.
>>
>>     Best,
>>     --------
>>     Ryan
>>
>>
>>     On Sun, May 30, 2021 at 11:46 PM Ong Jian Fuh
>>     <jianfuh.ong at eli-np.ro <mailto:jianfuh.ong at eli-np.ro>> wrote:
>>     Dear Ryan,
>>
>>     Thanks for your reply. I am using FLASH4.6.2 and I believe
>>     this is the latest version. I still need to
>>     replace print msg to print(msg), which is still in python2.7.
>>     Fixing the symbol with "!=" then many more issues exist as
>>     you suggested. Such as
>>
>>      File "/home/ong/.local/lib/python3.8/site-packages/flash/flmake/setup_globals.py", line
>>     204, in set
>>         if type(value) != types.StringType:
>>     AttributeError: module 'types' has no attribute 'StringType'
>>
>>     Then I try using python2.7. and return the following error
>>
>>     Writing /home/ong/.local/lib/python2.7/site-packages/flash-0.1.egg-info
>>     Traceback (most recent call last):
>>       File "setup.py", line 207, in <module>
>>         run_setup()
>>       File "setup.py", line 199, in run_setup
>>         make_bash_completion()
>>       File "setup.py", line 118, in make_bash_completion
>>         import flash.flmake.__init__
>>     ImportError: No module named flash.flmake.__init__
>>
>>     Is there any update from FLASH's python tools to python3? I
>>     am using jupyter notebook which run on python3.8.8. Switching
>>     from one version to another would be quite troublesome.
>>
>>     In addition, I am not clear what the following lines in
>>     the user's guide do and how it relate to the simulation
>>
>>     $ mkdir temp
>>     $ cd temp
>>     $ flmake setup -auto Sedov
>>     $ flmake build -j 20
>>     $ flmake run -n 20
>>
>>     Regards,
>>
>>     Dr. Ong Jian Fuh
>>     Extreme Light Infrastructure - Nuclear Physics
>>     "Horia Hulubei" National Institute for Physics and Nuclear
>>     Engineering
>>     30 Reactorului Street, 077125 Magurele (Ilfov), Romania
>>
>>     www.eli-np.ro <http://www.eli-np.ro>
>>     On 28/05/2021 6:06 pm, Ryan Farber wrote:
>>>     Hi Ong,
>>>
>>>     I remember being mystified the first time I encountered that
>>>     archaic "diamond operator."
>>>
>>>     The easiest solutions are:
>>>     1. Use the latest FLASH, where they updated the python code to
>>>     be compatible with python3
>>>     2. Use python2 if you need to use an old version of FLASH (like
>>>     me :))
>>>
>>>     Or, you can replace "<>" with "!=", although there will be many
>>>     more issues you'll subsequently need to convert.
>>>
>>>     Best,
>>>     --------
>>>     Ryan
>>>
>>>
>>>     On Fri, May 28, 2021 at 8:33 AM Ong Jian Fuh
>>>     <jianfuh.ong at eli-np.ro <mailto:jianfuh.ong at eli-np.ro>> wrote:
>>>     Dear all,
>>>
>>>     Good afternoon. I am trying to install the FLASH python tools
>>>     for the plotting.
>>>
>>>     Doing python setup.py install --user
>>>
>>>     return
>>>
>>>     running install
>>>     running build
>>>     running build_py
>>>     copying python/metadata.json -> build/lib/flash
>>>     running build_scripts
>>>     running install_lib
>>>     copying build/lib/flash/metadata.json
>>>     -> /home/ong/.local/lib/python3.8/site-packages/flash
>>>     byte-compiling /home/ong/.local/lib/python3.8/site-packages/flash/flmake/utils.py to
>>>     utils.cpython-38.pyc
>>>     File "/home/ong/.local/lib/python3.8/site-packages/flash/flmake/utils.py", line
>>>     423
>>>         if len(parts) <> 2:
>>>                              ^
>>>     SyntaxError: invalid syntax
>>>
>>>     I am using python3.8. What can I do to fix this or use it with
>>>     new python? Thanks.
>>>
>>>     -- 
>>>     Regards,
>>>
>>>     Dr. Ong Jian Fuh
>>>     Extreme Light Infrastructure - Nuclear Physics
>>>     "Horia Hulubei" National Institute for Physics and Nuclear
>>>     Engineering
>>>     30 Reactorului Street, 077125 Magurele (Ilfov), Romania
>>>
>>>     www.eli-np.ro <http://www.eli-np.ro>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://flash.rochester.edu/pipermail/flash-users/attachments/20210607/0766e8f6/attachment.htm>


More information about the flash-users mailing list