- Notifications
You must be signed in to change notification settings - Fork0
support pyXspec (in Heasarc) on jupyter with matplotlib
License
NotificationsYou must be signed in to change notification settings
TomoTom0/yt_pyXspec
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
support pyXspec on jupyter with matplotlib
- clone this repository to local:
git clone https://github.com/TomoTom0/yt_pyXspec.git
- move to the cloned directory, local install with
pip
in the established mode at the same hierarchy assetup.py
:pip install -e .
In order to use fonts in matplotlib, you must do the following operation once.
# bashsudo apt install msttcorefonts -qqrm~/.cache/matplotlib -rf
# pythonimportmatplotlibmatplotlib.font_manager._rebuild()
For example,
importos,glob2,reimportyt_pyXspec# working directory pathdir_path=os.environ["HOME"]+"/XXXXXXXXXXX/fit"# how to define a graph title from the xcm path# if title_func or its return value is None, there is no titledeftitle_func(xcm_path):#return (["double_pow"+s for s in re.findall(r"\d{4}-\d{2}-\d{2}", os.path.split(xcm_path)[1])]+[None])[0]returnos.path.split(xcm_path)[1]# how to define a image path from the xcm path# if exportImagePath_func or its return value is None, there is no export filedefexportImagePath_func(xcm_path):#return "graph_eeu-del_"+(re.findall(r"\d{4}-\d{2}-\d{2}", os.path.split(xcm_path)[1])+[None])[0]+".pdf"returnos.path.split(xcm_path)[1].replace(".xcm",".pdf")# automatically chage directory to dir_pathytpx=yt_pyXspec.Ytpx(dir_path)# select xcm paths whose plot you want to export as image file# in the appropriate method; glob2.glob("all_doublePow*2022-04-*.xcm")xcm_paths=["AAAA.xcm","BBBB.xcm"]# plot graph from xcm paths and export as image file# plots allow "eeu", "eem", "ld", "del", "ratio"fig_axs_dic=ytpx.plot_datass_fromXcms(xcms=xcm_paths,title_func=title_func,exportImagePath_func=exportImagePath_func,plots=["eeu","del"])
- iterable;
["eeu", "ld"]
- plot graphs of the inputed type
- recommended values are
"eeu", "eem", "ld", "del", "ratio"
- iterable;
[range_min, range_max]
- a range of x-axis
- if not inputted, the range is determined by the value of data
- dict;
{"eeu": [range_min, range_max], "ld":[range_min, range_max]}
- ranges of y-axis for plot types
- if not inputted, the range is determined by the value of data
- iterable;
["royalblue", "red", "oliverdrab"]
- a color set of plot
- check the reference of matplotlib to know valid values
- iterable;
["^", "o", "+"]
- a marker set of plot
- check the reference of matplotlib.pyplot.scatter to know valid values
- dict
{"eeu": datass}
- if not inputted, datas_s are obtained from the present pyXspec environments
- if you use
plot_datass_fromXcms
, you should not inputdatass
- str
"/home/XXXXXXXXXXX/AAA.pdf"
- if not inputed, a image of the graph is not exported
- check the reference of matplotlib.pyplot.figure.savefig to know allowed extensions
- if you use
plot_datas_fromXcms
, you should useexportImagePath_func
- str
"AAAAAAA"
- a title on the top of the graph
- if not inputed, there is no title
- if you use
plot_datas_fromXcms
, you should usetitle_func
legends_dic
legends_sort
flag_dataPlot: True
flag_modelPlot: True
flag_compPlot: True
flag_modelStep: False
marker_size_data: 0
elinewith_data: 1
marker_size_mdoel: 0
elinewidth_model: 0.5
email:tomoIris427+Github@gmail.com
MIT
About
support pyXspec (in Heasarc) on jupyter with matplotlib
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.