Comments (17)
@alexmaragko : have you installed pahfit? This is now needed to get the run_pahfit command installed on your system. Check out the install instructions at:
https://pahfit.readthedocs.io/en/latest/install.html
I think this will solve the problem, but am not sure. Please try and tell me. :-)
from pahfit.
@karllark Yes I have installed pahfit.
from pahfit.
I will modify the code a bit to get the units in and make some runs for Monday's telecon though. :)
from pahfit.
Can you post the output error message? I don't understand why it doesn't work if you have installed it.
from pahfit.
This is the output for M101_Nucleus_irs.ipac:
Traceback (most recent call last):
File "/usr/local/bin/run_pahfit", line 4, in
import('pkg_resources').run_script('pahfit==2.0.dev88', 'run_pahfit')
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 750, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 1527, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.5/dist-packages/pahfit-2.0.dev88-py3.5.egg/EGG-INFO/scripts/run_pahfit", line 88, in
pmodel = PAHFITBase(filename=packfile)
File "/usr/local/lib/python3.5/dist-packages/pahfit-2.0.dev88-py3.5.egg/pahfit/base.py", line 123, in init
param_info = self.read(filename, tformat=tformat)
File "/usr/local/lib/python3.5/dist-packages/pahfit-2.0.dev88-py3.5.egg/pahfit/base.py", line 373, in read
t = Table.read(filename, format=tformat)
File "/usr/local/lib/python3.5/dist-packages/astropy/table/table.py", line 2531, in read
out = io_registry.read(cls, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/astropy/io/registry.py", line 516, in read
reader = get_reader(format, cls)
File "/usr/local/lib/python3.5/dist-packages/astropy/io/registry.py", line 449, in get_reader
data_format, data_class.name, format_table_str))
astropy.io.registry.IORegistryError: No reader defined for format '5/dist-packages/pahfit-2' and class 'Table'.
The available formats are:
Format Read Write Auto-identify Deprecated
ascii Yes Yes No
ascii.aastex Yes Yes No
ascii.basic Yes Yes No
ascii.cds Yes No No
ascii.commented_header Yes Yes No
ascii.csv Yes Yes No
ascii.daophot Yes No No
ascii.ecsv Yes Yes Yes
ascii.fast_basic Yes Yes No
ascii.fast_commented_header Yes Yes No
ascii.fast_csv Yes Yes No
ascii.fast_no_header Yes Yes No
ascii.fast_rdb Yes Yes No
ascii.fast_tab Yes Yes No
ascii.fixed_width Yes Yes No
ascii.fixed_width_no_header Yes Yes No
ascii.fixed_width_two_line Yes Yes No
ascii.html Yes Yes Yes
ascii.ipac Yes Yes No
ascii.latex Yes Yes Yes
ascii.no_header Yes Yes No
ascii.rdb Yes Yes Yes
ascii.rst Yes Yes No
ascii.sextractor Yes No No
ascii.tab Yes Yes No
fits Yes Yes Yes
hdf5 Yes Yes Yes
votable Yes Yes Yes
aastex Yes Yes No Yes
cds Yes No No Yes
csv Yes Yes Yes Yes
daophot Yes No No Yes
html Yes Yes No Yes
ipac Yes Yes No Yes
latex Yes Yes No Yes
rdb Yes Yes No Yes
When I rename orion_bar_SWS_with7023shape.txt to orion_bar_SWS_with7023shape.ascii then the error is for the obs_spectrum['wavelength'] variable in the next line.
Traceback (most recent call last):
File "/usr/local/bin/run_pahfit", line 4, in
import('pkg_resources').run_script('pahfit==2.0.dev88', 'run_pahfit')
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 750, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/local/lib/python3.5/dist-packages/pkg_resources/init.py", line 1527, in run_script
exec(code, namespace, namespace)
File "/usr/local/lib/python3.5/dist-packages/pahfit-2.0.dev88-py3.5.egg/EGG-INFO/scripts/run_pahfit", line 66, in
obs_x = obs_spectrum['wavelength'].to(u.micron,
File "/usr/local/lib/python3.5/dist-packages/astropy/table/table.py", line 1222, in getitem
return self.columns[item]
File "/usr/local/lib/python3.5/dist-packages/astropy/table/table.py", line 106, in getitem
return OrderedDict.getitem(self, item)
KeyError: 'wavelength'
from pahfit.
Can you post what the command you are issuing on the command line is for the 1st part?
For the 2nd part, this is because the names of the columns are different than expected and the units are not defined in the file. You could add them, but probably need to update the format of the header to be like that for the M101 example. I did not do all this for the example data, just M101. But clearly should have.
from pahfit.
run_pahfit M101_Nucleus_irs.ipac scipack_ExGal_SpitzerIRSSLLL.ipac
I have copied the spectrum files into a different directory than pahfit, and making the runs.
from pahfit.
For the first part, it looks like it is not parsing the string that is the filename correctly. The format table string it should be passing should be 'ipac' and it looks like it is passing '5/dist-packages/pahfit-2'. I don't understand.
from pahfit.
Indeed changing the split index to -1 did the trick. I was able to make runs for both spectra without issues.
However, the txt extension is not recognized by the astropy reader and probably it should be renamed to ascii, or alternatively set a statement in the code to match txt with ascii extension internally.
Another thing to consider is how to set the units in the ascii input spectrum, so that the unit conversion part of the code applies to everything. I believe only ECSV format can accept units but not the ascii format. For ascii input spectra we could potentially require to have a second comment line with the units, and assign them in the code before the unit conversion.
Let me know what you think before I make a pull request.
from pahfit.
Another solution is to replace the ascii input spectrum with an ecsv or ipac format version that includes units.
I would create a small amount of code that reads in the ascii spectrum, adds units, then outputs as an ecsv file. Would be good to have alternate formats as part of the examples.
from pahfit.
Really glad changing the index to -1 worked!
from pahfit.
You can always make a pull request whenever and then update it as needed (just push the the branch used for the pull request).
from pahfit.
Another solution is to replace the ascii input spectrum with an ecsv or ipac format version that includes units.
I would create a small amount of code that reads in the ascii spectrum, adds units, then outputs as an ecsv file. Would be good to have alternate formats as part of the examples.
You mean create and replace the orion_bar_SWS_with7023shape.txt spectrum with an ipac or ecsv equivalent to have it permanently in the data folder of pahfit?
from pahfit.
Yes.
from pahfit.
Ok will do it first chance.
from pahfit.
I've turned orion_bar_SWS_with7023shape.txt into ipac format, so now pahfit can read it and fit it.
I've also added another spectrum in the data folder that @ThomasSYLai sent to me, and turned it into ecsv format in order to showcase one more input example.
In order to read ecsv files though, the Table.read format must be "ascii.ecsv". But if the input spectrum is e.g., "spectrum.ecsv" it will raise an error. So I've added a line to turn ecsv to ascii.ecsv.
Since we are currently sticking with input formats that have the units defined, ecsv will be the only "ascii"-type format that requires the special handling of ecsv --> ascii.ecsv, so we shouldn't be troubled to specify conversions for other ascii inputs.
from pahfit.
Great! Looking forward to the pull request for these changes!
from pahfit.
Related Issues (20)
- SWS Resolution Issue HOT 3
- ISO WL Bounds Mismatch HOT 3
- Do compact features (PAHs/absorption/etc) need resolution "coarsening"? HOT 1
- README in data folder should be updated? HOT 1
- Instrument packs: Not clear to user what is available HOT 1
- Overview: changes before merging dev into master HOT 2
- Possible changes to make dev branch docs more user friendly HOT 2
- Output fit spectrum? HOT 14
- refactor all model-framework-specific code HOT 3
- weird test issue HOT 2
- starlight sub_model error HOT 1
- Channels, adding features, plotting HOT 27
- How to signal to user that features were not fit? HOT 1
- Possible API change: Separate fit results from Model HOT 1
- New internal API: agnostic functional model setup / results retrieval HOT 7
- New Science Packs after v2.5
- PAHFIT 2.5 version : interpolate fitting problem for Spitzer short-high / long-high spectra HOT 6
- Issue with compatibility with Astropy -- I think HOT 2
- Atomic lines fitting too narrow HOT 1
- Converting PAH Amplitudes to Fluxes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pahfit.