Hello Matt

Thank you for your kindness.

I simplified the ff2chi problem in multiprocessing. I found that the ff2chi
problem in multiprocessing is caused by receiving the arguments in an
object (TestClass).

For instance
The below code works in multiprocessing
---------------------------------------------
class TestClass():
    def __init__(self, out_path_lists):
        self.path_lists=out_path_lists

    def test(self):
        path1 = feffpath(os.path.join(dPath,'FEFF1', fname1))
        path_lists=[path1]
        theory_sum=Group(label='theory_group_sum')
        ff2chi(path_lists, group=theory_sum)
        new_state=theory_sum.ch

However, If I change ff2chi(path_lists, group=theory_sum) to*
ff2chi(self.path_lists, group=theory_sum*), the ff2chi problem is caused.

Finally, I want to use multiprocessing. The xraylarch you sent does not
work in multiprocessing.
If you are possible, please send me larch 0.9.71 to reinstall


2024년 2월 7일 (수) 오전 7:37, Matt Newville <newvi...@cars.uchicago.edu>님이 작성:

> Hi Eun-Suk,
>
> Did you do
>        python -m pip install
>
> https://millenia.cars.aps.anl.gov/xraylarch/downloads/xraylarch-latest-py3-none-any.whl
>
> ?
> That will install the development version (later than 0.9.74, not yet
> 0.9.75, sorry for that delay).  This works for me:
>
>   from larch.xafs import feffpath
>   p1 = feffpath('feff0001.dat', e0=-1, sigma2=0.010)
>   p1.s02 = 0.95
>   dat = ff2chi([p1])
>
> I don't know of any multiprocessing problem...
>
> Cheers,
>
> On Tue, Feb 6, 2024 at 11:05 PM 정은석 <eunsuk1...@jbnu.ac.kr> wrote:
> >
> > Hello  Matt.
> >
> > I think that you need some time to fix the 'multi-processing problem of
> 0. 9.74'. If you take a little long time to fix it, can you send me
> xraylarch version 0.9.71? or could you inform me of the site of the old
> version?
> > I will reinstall xraylarch with it.
> >
> > Thank you for your effort and contribution
> >
> > 2024년 2월 5일 (월) 오후 5:09, 정은석 <eunsuk1...@jbnu.ac.kr>님이 작성:
> >>
> >> Hello Matt
> >>
> >> I changed my original code to simple code for you as below.
> >> I found the problem of larch 0.9.74 in multi-processing.
> >> You can check it with the below code. How can I fix this problem?
> >>
> >>
> ------------------------------------------------------------------------------------------------------------
> >> ############# Multi-processing test ########################
> >> import larch
> >> from larch import Group
> >> from larch.utils import *
> >> from larch.xafs import *
> >> from larch.io import *
> >>
> >> import numpy as np
> >> import os
> >> import torch.multiprocessing as mp
> >>
> >> dPath = r'C:\Users\Administrator\Desktop\RL\feffit_error_test'
> >> os.chdir(dPath)
> >> fname1 = 'feff0001.dat'  # N=1, Reff=1.9 N
> >>
> >> path1 = feffpath(os.path.join(dPath,'FEFF1', fname1))
> >> #################################
> >> path_lists=[path1]
> >> path_lists[0].s02=0.86
> >> ################################################
> >>
> >> class Func():
> >>     def __init__(self, path_lists):
> >>         self.path_lists=path_lists
> >>
> >>     def step(self):
> >>         self.path_lists[0].e0, self.path_lists[0].degen,
> self.path_lists[0].deltar, self.path_lists[0].sigma2 = [2, 5, 0.001, 0.004]
> >>     ## Theory path들의 합과 theory FFT
> >>         theory_sum=Group(label='theory_group_sum')
> >>         ff2chi(self.path_lists, group=theory_sum)
> >>         new_state=theory_sum.chi
> >>         return new_state
> >>
> >> class TestClass():
> >>     def __init__(self, path_lists):
> >>         self.path_lists=path_lists
> >>
> >>     def test(self):
> >>         func1 = Func(self.path_lists)
> >>         s=func1.step()
> >> ############################################
> >>
> >> T_func=TestClass(path_lists)
> >> F_func=Func(path_lists)
> >>
> >> if __name__ == '__main__':
> >>     process_list=[]
> >>     p_N =mp.Process(target=T_func.test,)
> >>     p_N.start()
> >>     process_list.append(p_N)
> >>     for process in process_list:
> >>         process.join()
> >> ##################################################################
> >> #####Problem##########
> >>   File
> "C:\ProgramData\anaconda3\envs\xraylarch\Lib\multiprocessing\process.py",
> line 314, in _bootstrap
> >>     self.run()
> >>   File
> "C:\ProgramData\anaconda3\envs\xraylarch\Lib\multiprocessing\process.py",
> line 108, in run
> >>     self._target(*self._args, **self._kwargs)
> >>   File
> "c:\Users\Administrator\Desktop\RL\feffit_error_test\test-ff2chi-problem.py",
> line 40, in test
> >>     s=func1.step()
> >>       ^^^^^^^^^^^^
> >>   File
> "c:\Users\Administrator\Desktop\RL\feffit_error_test\test-ff2chi-problem.py",
> line 30, in step
> >>     ff2chi(self.path_lists, group=theory_sum)
> >>   File
> "C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py",
> line 658, in ff2chi
> >>     path.create_path_params(params=params)
> >>   File
> "C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py",
> line 392, in create_path_params
> >>     parname = self.pathpar_name(pname)
> >>               ^^^^^^^^^^^^^^^^^^^^^^^^
> >>   File
> "C:\ProgramData\anaconda3\envs\xraylarch\Lib\site-packages\larch\xafs\feffdat.py",
> line 331, in pathpar_name
> >>     return f'{parname}_{self.dataset}_{self.hashkey}'
> >>                         ^^^^^^^^^^^^
> >> AttributeError: 'FeffPathGroup' object has no attribute 'dataset'
> >>
> >>
> >> 2024년 2월 5일 (월) 오전 4:44, Matt Newville <newvi...@cars.uchicago.edu>님이
> 작성:
> >>>
> >>> Hi Eun-Suk,
> >>>
> >>> All the examples with ff2chi and running feffit work for me.   I sort
> >>> of don't understand how that could happen (a FeffPathGroup does -- or
> >>> should -- have a `dataset` attribute).
> >>>
> >>> Can you provide an example that shows the problem?
> >>>
> >>> --Matt
> >>> _______________________________________________
> >>> Ifeffit mailing list
> >>> Ifeffit@millenia.cars.aps.anl.gov
> >>> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
> >>> Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit
> >>
> >>
> >>
> >> --
> >> Best regards,
> >>
> >> Ph. D. Eun-Suk Jeong
> >> X-ray absorption fine structure(EXAFS+XANES)
> >> Mobile:+82-10-4628-9896
> >>
> >>
> >
> >
> > --
> > Best regards,
> >
> > Ph. D. Eun-Suk Jeong
> > X-ray absorption fine structure(EXAFS+XANES)
> > Mobile:+82-10-4628-9896
> >
> >
> > _______________________________________________
> > Ifeffit mailing list
> > Ifeffit@millenia.cars.aps.anl.gov
> > http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
> > Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit
>
>
>
> --
> --Matt Newville <newville at cars.uchicago.edu> 630-327-7411
>
> _______________________________________________
> Ifeffit mailing list
> Ifeffit@millenia.cars.aps.anl.gov
> http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
> Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit
>


-- 
Best regards,

Ph. D. Eun-Suk Jeong
X-ray absorption fine structure(EXAFS+XANES)
Mobile:+82-10-4628-9896
_______________________________________________
Ifeffit mailing list
Ifeffit@millenia.cars.aps.anl.gov
http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit

Reply via email to