tdaylan / pcat

A transdimensional, hierarchical, Bayesian framework to sample from a metamodel
MIT License
5 stars 4 forks source link

generating mock data #1

Open jasonfan1997 opened 6 years ago

jasonfan1997 commented 6 years ago

I am trying to generate some mock data of fermi but i have no idea about the procedure of it. Also , I want to know if the tuto.py working or not because I face some error when run it. What kind of file do I need to prepare if I try to generating mock data? Would you please kindly show me the steps?

tdaylan commented 6 years ago

Hi Jason,

Sorry for the late reply. tuto.py was working when I first wrote it. But it may have been outdated with never versions of the code base. Let me check this week and get back to you.

As for generating mock data, you basically need to call pcat.main.init() without any input data file (i.e., without setting strgexpr). This will force PCAT into simulated-data mode. It will generate a mock dataset from a 'true model', which has default values for all of its parameters. So you can change these defaults by setting the relevant argument to pcat.main.init() (e.g., trueXXXX, where XXXX is the name of the parameter of the true model).

Note that you still need to specify the argument strgexpo (in order to define exposure — could be a string with the name of a fits file, or a single float number if exposure is constant) and background template(s).

Best, Tansu

On Sep 10, 2017, at 8:11 AM, jasonfan1997 notifications@github.com wrote:

I am trying to generate some mock data of fermi but i have no idea about the procedure of it. Also , I want to know if the tuto.py working or not because I face some error when run it. What kind of file do I need to prepare if I try to generating mock data? Would you please kindly show me the steps?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tdaylan/pcat/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AKP9BgSqnf_uW-UYtLmv4PTb8XJR8TU0ks5sg9IOgaJpZM4PSTJB.

jasonfan1997 commented 6 years ago

Hi Tansu

Thank you for your reply, but I have faced a new problem when I try to run pcat.main.inti(). This error message show up

PCAT v0.3 started at 20170923_211940 Configuration Initializing... 1000000 samples will be taken, discarding the first 500000. The chain will be thinned by a factor of 5000. The resulting chain will contain 100 samples per chain and 100 samples in total. Traceback (most recent call last):

File "", line 1, in runfile('/home/jason/pcatproject/temp.py', wdir='/home/jason/pcatproject')

File "/home/jason/anaconda3/envs/py27/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 688, in runfile execfile(filename, namespace)

File "/home/jason/anaconda3/envs/py27/lib/python2.7/site-packages/spyder/utils/site/sitecustomize.py", line 93, in execfile builtins.execfile(filename, *where)

File "/home/jason/pcatproject/temp.py", line 22, in pcat.main.init()

File "/home/jason/anaconda3/envs/py27/lib/python2.7/site-packages/pcat/main.py", line 513, in init if gdat.binsenerfull == None:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

jasonfan1997 commented 6 years ago

After I add .any() at the back, it work. But a new problem come out is this line when I run tuto.py fileh5py = h5py.File(gdat.pathdata + 'inpt/adis.h5','r') which do not exist I have no idea what adis.h5 is can you kindly explain? Thank You

tdaylan commented 6 years ago

Hi Jason,

I see. adis.h5 (along with adiscoef.h5) are files that contain the angular diameter distance as a function of redhisft, which allow the user to associate sky (i.e., angular) distances to physical distances for a given redshift. I should have made it optional, though, because currently it is only useful for strong lensing. I am attaching these files (to be put in $PCAT_DATA_PATH/inpt) so it won’t complain.

I pushed a new version of PCAT that should solve any issues with tuto.py. You can just

git pull pcat

to get the development version.

Thanks!

Best, Tansu

On Sep 23, 2017, at 9:48 AM, jasonfan1997 notifications@github.com wrote:

After I add .any() at the back, it work. But a new problem come out is this line when I run tuto.py fileh5py = h5py.File(gdat.pathdata + 'inpt/adis.h5','r') which do not exist I have no idea what adis.h5 is can you kindly explain? Thank You

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tdaylan/pcat/issues/1#issuecomment-331637059, or mute the thread https://github.com/notifications/unsubscribe-auth/AKP9BqGY-D37cSa3zhunx0xdGVxP3OSCks5slQwigaJpZM4PSTJB.

jasonfan1997 commented 6 years ago

Hi

I still getting the same error after I pull development version pcat. IOError: Unable to open file (Unable to open file: name = '/home/jason/data/inpt/adis.h5', errno = 2, error message = 'no such file or directory', flags = 0, o_flags = 0)

Best Jason