Walkthrough of: 1) Making a custom galaxy catalogue and uploading it to a sql database 2) Getting an OpSim visit ID number. 3) Running CatSim over your custom galaxy catalogue. 4) Running PhoSim over the resulting instance catalogue. Pre-requisites: You'll need a DM stack installation. See this page for how to do that: https://dev.lsstcorp.org/trac/wiki/Installing Note that this is not exhaustive: installing catsim, for example, requires some python sql packages you may not have (pysqlalchemy for example). I make no guarantee that this will work, but it should give you an idea of what you need to do for this case study. Also note that this contains some usernames etc specific to me! ################################################## ##### 1) Making my own galaxy catalogue ##### ################################################## ## do this with the code in the github recipe book: git clone https://github.com/DarkEnergyScienceCollaboration/ImageSimulationRecipes.git cd ImageSimulationRecipes/python/utensils/ ## edit galdb.sql so that it points to your own database name. mysql -h lsst10.ncsa.illinois.edu -u USERNAME -p source galDB.sql ## have a look at what's in there. describe galaxiesTest; select * from galaxiesTest limit 10; ################################################## ##### 2) Getting OpSim visit ID number ##### ################################################## ### make your own opsim database: ## download: http://opsimcvs.tuc.noao.edu/runs/opsim3.61/opsim3.61.html http://opsimcvs.tuc.noao.edu/runs/opsim3.61/output_opsim3_61.sql.gz ## log in to your favourite db server mysql -h lsst10.ncsa.illinois.edu -u USERNAME -p create database MyUsername_opsim; use MyUsername_opsim; source output_opsim3_61.sql; ## here's one I made earlier (you will not be able to access it, alas): use djbard_galaxies; show tables; describe output_opsim3_61; select obsHistID from output_opsim3_61 where fieldRA between 1.41 and 1.42 and fieldDEC between -0.22 and -0.21 and filter="r" and airmass between 1 and 1.1 and seeing between 0.6 and 0.7; ## I chose... 87393588 ################################################## ### 3) Running catsim over those catalogues ### ################################################## ## to install from scratch (path is, obviously, specific to your machine): ## We are assuming the LSST stack is already installed somewhere - we are using loadLSST.csh from that installation. cd /local/tmp/djbard/cats2/ source /astro/apps6/lsst/loadLSST.csh mksandbox LSST ## open a new terminal because some environmental variables get messed up sometimes... cd /local/tmp/djbard/cats2/ setenv LSST_DEVEL $PWD/LSST/ source /astro/apps6/lsst/loadLSST.csh cd LSST/Linux64/ git clone http://dev.lsstcorp.org/git/LSST/sims/catalogs/generation generation git clone http://dev.lsstcorp.org/git/LSST/sims/catalogs/measures measures git clone http://dev.lsstcorp.org/git/LSST/sims/throughputs throughputs ## this will take some time. ## here's one I made earlier! ## It's vital to set this env to set up the relevant packages. setenv LSST_DEVEL /local/tmp/djbard/cats/LSST/ source /astro/apps6/lsst/loadLSST.csh cd /local/tmp/djbard/cats/LSST/Linux64/ ## setup everything you need to run catsim. eups declare --nolocks -r throughputs throughputs 1.0 setenv CAT_SHARE_DATA /astro/net/lsst1/shared setup -r generation setup -r measures setup lsst setup base setup scipy setenv TDSVER 7.0 setup mysqlclient setup mysqlpython ### now I can run the example... cd generation/tests python runConn.py ##(note that, in the current master version, this one will *not* work. It should be fixed next week. ) cd ../../measures/tests python runCats.py ## What about if I want to run on my own catalogue? ## You'll need to edit the ExampleGalaxyObject class in generation/python/lsst/sims/catalogs/generation/db/GalaxyModels.py. If you use the database given above, basically all you need to do is to change the 'tableid' field to the name of your galaxy db 'galaxiesTest' for example). ## The other thing you will want to do is to make a text file in your home directory called 'dbLogin'. This will contain one line of text to log you in to your sql database, eg: mysql://USERNAME:PASSWORD@lsst10.ncsa.uiuc.edu/DATABASENAME ## then edit runCats.py to point to your new galaxy type, something like this: objectDict['exampleGalaxy'] = {'dbobj':DBObject.from_objid('exampleGalaxyBase'), 'constraint':" sedname_bulge is not NULL", 'filetype':'trim_catalog_SERSIC2D', 'obsMetadata':obs_metadata} ## In the line obs_metadata, make sure you have specified the correct obsHistID, and a large enough range (eg >0.3 degrees) that you'll pick up your galaxies: obs_metadata = obsMD.getObservationMetaData(87393588, 0.5, makeCircBounds=True) ## this will give you an instance catalogue you can use as input to phosim! ################################################## ### 4) Running PhoSim over these catalogues ### ################################################## ## you need phosim installed: ## walkthough described here: https://confluence.slac.stanford.edu/display/LSSTDESC/phoSim+Walkthrough git clone http://dev.lsstcorp.org/git/LSST/sims/phosim ./configure make ## Test using examples: (you'll need to make a directory called work, and one called output) ./phosim examples/star -c examples/nobackground ## copy over my instance catalogue that I just made in the the examples directory, and run on it. ## set up DM stack (this time at SLAC) source /afs/slac/g/lsst/software/redhat6-x86_64-64bit-gcc44/DMstack/Winter2013-v6_2/loadLSST.csh ./phosim examples/catalog_test_mygalaxyDisk.dat -c examples/nobackground ## and there you go! You should have all your images in the output directory.