tomography / XRFtomo

a repository for xray fluorescence data processing
Other
3 stars 6 forks source link

directory for the config file #56

Open sichendart opened 4 years ago

sichendart commented 4 years ago

By doing the following, the xrftomo.config was generated under /Users/sichen

(XRFtomo) Ahri-59:XRFtomo sichen$ pwd /Users/sichen/src/XRFtomo (XRFtomo) Ahri-59:XRFtomo sichen$ XRFtomo init

It makes more sense to generate it under /Users/sichen/src/XRFtomo. I also check the directory for the configure file when the software is quit. It is under /Users/sichen/src/XRFtomo.

decarlof commented 4 years ago

Actually this change was intentional: Most of the users will not built the code from source by rather install it from a conda channel. In this case is better to save the config in a location that always exists (user home) rather than the directory from where it was lunched.

sichendart commented 4 years ago

OK. In that case, shall we always save the config file in the user home directory, for example, when we save from the menu or when the software quits.

decarlof commented 4 years ago

correct, the config file is designed to keep the status of the software on file exit, its location is set in this line of the config.py file and stays the same so the program can restore its status at startup as well save it on quit.

FabricioSMarin commented 4 years ago

I find that xrftomo.conf gets created in the bin directory if there is one not already available in the home directory when running xrftomo gui. Entering xrftomo init on the other hand does create the file in the home directory. I'm not sure if this is intentional or if it can be changed to automatically save to the home path regardless of initializing first with xrftomo init or not.

decarlof commented 4 years ago

This in not the intentional behavior: there should be only one config file. In this line the config file name is hard coded. This should be changed in:

config.write(args.config, args=self.params, sections=sections)
FabricioSMarin commented 4 years ago

I'm using expanduser("~") to find the home path and write the config file there. Would something like this work? So far I haven't encountered issues with starting XRFtomo from any window or path.

from os.path import expanduser            

home = expanduser("~")
config.write('{}/xrftomo.conf'.format(home), args=self.params, sections=sections)