Plotting with python script
-
- Posts: 34
- Joined: October 05 2013
- Affiliation: Sogang univ.
Plotting with python script
Dear All,
I have been trying to reproduce the very last figure of the following link: http://cosmologist.info/cosmomc/readme_planck.html
I have done up to the "Ploting" section but I have a some problem in this section.
What I have done before I got error is that:
1. I did symbolic link in the Using Planck Chains section as follows:
gansuh@soliton2:~/Code/cosmomc: ln -s /home/gansuh/Code/PLA/ ./PLA (where my cosmomc and PLA under Code directory, but separate)
2. to initialize it for the location:
gansuh@soliton2:~/Code/cosmomc: python python/makeGrid.py PLA settings_planck_nominal
3. to run getdist over the grid:
gansuh@soliton2:~/Code/cosmomc: python python/runGridGetdist.py PLA --burn_removed
4. After that:
gansuh@soliton2:~/Code/cosmomc: python batch1/outputs/triangle_planckonly_vs_WMAP.py
then error looks like:
gansuh@soliton2:~/Code/cosmomc: python batch1/outputs/triangle_planckonly_vs_WMAP.py
Traceback (most recent call last):
File "batch1/outputs/triangle_planckonly_vs_WMAP.py", line 13, in <module>
legend_labels=labs)
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 574, in triangle_plot
params = self.get_param_array(roots[0], in_params)
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 434, in get_param_array
if not isinstance(in_params[0], paramNames.paramInfo): return self.paramNamesForRoot(root).parsWithNames(in_params, error=True)
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 239, in paramNamesForRoot
if not root in self.param_name_sets: self.param_name_sets[root] = self.sampleAnalyser.paramsForRoot(root, labelParams=self.settings.param_names_for_labels)
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 147, in paramsForRoot
names = paramNames.paramNames(self.plot_data_file(root) + '.paramnames')
File "/home/gansuh/Code/cosmomc/python/paramNames.py", line 48, in __init__
if fileName is not None: self.loadFromFile(fileName)
File "/home/gansuh/Code/cosmomc/python/paramNames.py", line 117, in loadFromFile
f = open(fileName)
IOError: [Errno 2] No such file or directory: 'main/plot_data/base_planck_lowl_post_lensing.paramnames'
gansuh@soliton2:~/Code/cosmomc:
I have not make any directory named "main", but it showed up in the IOError.
Also I would like to make sure that whether I have done the previous steps correctly with your help. In the Using Planck Chains section, I make a symbolic link as following way
gansuh@soliton2:~/Code/cosmomc$ ln -s /home/gansuh/Code/PLA/ ./PLA
instead of "ln -s /scratch/planck/PLA ./PLA" is that correct?
Could you correct me to reproduce the last figure of the link that I have mentioned above?
Any suggestion would be helpful.
Thank you.
I have been trying to reproduce the very last figure of the following link: http://cosmologist.info/cosmomc/readme_planck.html
I have done up to the "Ploting" section but I have a some problem in this section.
What I have done before I got error is that:
1. I did symbolic link in the Using Planck Chains section as follows:
gansuh@soliton2:~/Code/cosmomc: ln -s /home/gansuh/Code/PLA/ ./PLA (where my cosmomc and PLA under Code directory, but separate)
2. to initialize it for the location:
gansuh@soliton2:~/Code/cosmomc: python python/makeGrid.py PLA settings_planck_nominal
3. to run getdist over the grid:
gansuh@soliton2:~/Code/cosmomc: python python/runGridGetdist.py PLA --burn_removed
4. After that:
gansuh@soliton2:~/Code/cosmomc: python batch1/outputs/triangle_planckonly_vs_WMAP.py
then error looks like:
gansuh@soliton2:~/Code/cosmomc: python batch1/outputs/triangle_planckonly_vs_WMAP.py
Traceback (most recent call last):
File "batch1/outputs/triangle_planckonly_vs_WMAP.py", line 13, in <module>
legend_labels=labs)
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 574, in triangle_plot
params = self.get_param_array(roots[0], in_params)
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 434, in get_param_array
if not isinstance(in_params[0], paramNames.paramInfo): return self.paramNamesForRoot(root).parsWithNames(in_params, error=True)
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 239, in paramNamesForRoot
if not root in self.param_name_sets: self.param_name_sets[root] = self.sampleAnalyser.paramsForRoot(root, labelParams=self.settings.param_names_for_labels)
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 147, in paramsForRoot
names = paramNames.paramNames(self.plot_data_file(root) + '.paramnames')
File "/home/gansuh/Code/cosmomc/python/paramNames.py", line 48, in __init__
if fileName is not None: self.loadFromFile(fileName)
File "/home/gansuh/Code/cosmomc/python/paramNames.py", line 117, in loadFromFile
f = open(fileName)
IOError: [Errno 2] No such file or directory: 'main/plot_data/base_planck_lowl_post_lensing.paramnames'
gansuh@soliton2:~/Code/cosmomc:
I have not make any directory named "main", but it showed up in the IOError.
Also I would like to make sure that whether I have done the previous steps correctly with your help. In the Using Planck Chains section, I make a symbolic link as following way
gansuh@soliton2:~/Code/cosmomc$ ln -s /home/gansuh/Code/PLA/ ./PLA
instead of "ln -s /scratch/planck/PLA ./PLA" is that correct?
Could you correct me to reproduce the last figure of the link that I have mentioned above?
Any suggestion would be helpful.
Thank you.
-
- Posts: 1944
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Plotting with python script
The web page example explicitly sets the correct PLA/plot_data directory in the sample code. The scripts in batch1/outputs assume main/plot_data assume the default ./main directory - you can probably just make a symbolic link from ./main to your PLA directory.
-
- Posts: 34
- Joined: October 05 2013
- Affiliation: Sogang univ.
Re: Plotting with python script
Dear Antony,
Thank you for the reply.
Let me make sure two things.
To make a symbolic link, I have used following line:
gansuh@soliton2:~/Code/cosmomc: ln -s /home/gansuh/Code/all_tar_files/PLA/ ./PLA
where "~/Code/cosmomc$" directory is my main directory(I think) and "/home/gansuh/Code/all_tar_files/PLA/" is the path where PLA is located.
Since it worked out, I guess, maybe I've understood coreectly, but please give a comment on these two.
Best,
Gansukh
Thank you for the reply.
Let me make sure two things.
You mean that the main directory is the cosmomc directory, and the scripts in batch1/outputs assume it as main directory, is that right?Antony Lewis wrote:The scripts in batch1/outputs assume main/plot_data assume the default ./main directory - you can probably just make a symbolic link from ./main to your PLA directory.
To make a symbolic link, I have used following line:
gansuh@soliton2:~/Code/cosmomc: ln -s /home/gansuh/Code/all_tar_files/PLA/ ./PLA
where "~/Code/cosmomc$" directory is my main directory(I think) and "/home/gansuh/Code/all_tar_files/PLA/" is the path where PLA is located.
Since it worked out, I guess, maybe I've understood coreectly, but please give a comment on these two.
Best,
Gansukh
-
- Posts: 1944
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Plotting with python script
in your cosmomc directory
ln -s ./PLA ./main
("main" being "main", not a placeholder for your cosmomc directory)
ln -s ./PLA ./main
("main" being "main", not a placeholder for your cosmomc directory)
-
- Posts: 34
- Joined: October 05 2013
- Affiliation: Sogang univ.
Plotting with python script
Dear Antony,
Thank you for the previous replies.
I have another problem when I run the web page example. The following error occured:
Could you suggest me what I can do in this case, please?
Thank you.
The best,
Gansukh Tumurtushaa
Thank you for the previous replies.
I have another problem when I run the web page example. The following error occured:
Code wrote:
gansuh@soliton2:~/Code/cosmomc: python batch1/outputs/triangle_planckonly_vs_WMAP.py
Traceback (most recent call last):
File "batch1/outputs/triangle_planckonly_vs_WMAP.py", line 14, in <module>
g.export('triangle_planckonly_vs_WMAP')
File "/home/gansuh/Code/cosmomc/python/planckStyle.py", line 53, in export
GetDistPlots.GetDistPlotter.export(self, 'outputs/' + fname + '.pdf')
File "/home/gansuh/Code/cosmomc/python/GetDistPlots.py", line 698, in export
savefig(fname, bbox_extra_artists=self.extra_artists, bbox_inches='tight')
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 471, in savefig
return fig.savefig(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1185, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 2021, in print_figure
**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backend_bases.py", line 1789, in print_pdf
return pdf.print_pdf(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_pdf.py", line 2180, in print_pdf
file = PdfFile(filename)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_pdf.py", line 370, in __init__
fh = file(filename, 'wb')
IOError: [Errno 2] No such file or directory: 'outputs/triangle_planckonly_vs_WMAP.pdf'
gansuh@soliton2:~/Code/cosmomc:
Could you suggest me what I can do in this case, please?
Thank you.
The best,
Gansukh Tumurtushaa
-
- Posts: 34
- Joined: October 05 2013
- Affiliation: Sogang univ.
Plotting with python script
Dear Antony,
Thank you for the all helpful feed back.
Finally, I have reproduced the web page example.
Thank you very much once again.
The best,
Gansukh Tumurtushaa
Thank you for the all helpful feed back.
Finally, I have reproduced the web page example.
Thank you very much once again.
The best,
Gansukh Tumurtushaa
-
- Posts: 34
- Joined: October 05 2013
- Affiliation: Sogang univ.
Plotting with python script
By the way,
Can one still reproduce web page example with the latest March 2014 version?
-Gansukh
Can one still reproduce web page example with the latest March 2014 version?
-Gansukh
-
- Posts: 1944
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Plotting with python script
Should work much the same.
-
- Posts: 34
- Joined: October 05 2013
- Affiliation: Sogang univ.
Plotting with python script
An attributeError occurred after running the latest CosmoMC with following command:
The command was fine with previous one, Dec2013 version.
Would you kindly help me to figure it out?
Thank you.
Code: Select all
gansuh2@soliton2:~/project1/cosmomc$ python python/makeGrid.py PLA settings_planck_nominal
Traceback (most recent call last):
File "python/makeGrid.py", line 40, in <module>
batch.makeItems(settings.groups)
File "/home/gansuh2/project1/cosmomc/python/batchJob.py", line 227, in makeItems
item.makeImportance(group.importanceRuns)
File "/home/gansuh2/project1/cosmomc/python/batchJob.py", line 79, in makeImportance
if len(arr) > 2 and not arr[2].wantImportance(self): continue
File "/home/gansuh2/project1/cosmomc/python/settings_planck_nominal.py", line 50, in wantImportance
return planck in jobItem.dataname_set and (not'omegak' in jobItem.param_set or (len(jobItem.param_set) == 1))
AttributeError: jobItem instance has no attribute 'dataname_set'
Would you kindly help me to figure it out?
Thank you.
-
- Posts: 1944
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Plotting with python script
Ah, think I forgot to move across the updated file to the release version.. try changing the offending line to
Code: Select all
return planck in jobItem.data_set.names and (not'omegak' in jobItem.param_set or (len(jobItem.param_set) == 1))
-
- Posts: 34
- Joined: October 05 2013
- Affiliation: Sogang univ.
Plotting with python script
Wow you are the best!
Now it works. Thank you.
Now it works. Thank you.
-
- Posts: 1944
- Joined: September 23 2004
- Affiliation: University of Sussex
- Contact:
Re: Plotting with python script
Should now be fixed in the April 2014 cosmomc version