diff --git a/scripts/protoDC2/generateDc2InstCat.py b/scripts/protoDC2/generateDc2InstCat.py index 0962312..ec69e3e 100644 --- a/scripts/protoDC2/generateDc2InstCat.py +++ b/scripts/protoDC2/generateDc2InstCat.py @@ -18,7 +18,7 @@ class MaskedPhoSimCatalogPoint(PhoSimCatalogPoint): min_mag = None column_outputs = ['prefix', 'uniqueId', 'raPhoSim', 'decPhoSim', 'maskedMagNorm', 'sedFilepath', - 'redshift', 'shear1', 'shear2', 'kappa', 'raOffset', 'decOffset', + 'redshift', 'gamma1', 'gamma2', 'kappa', 'raOffset', 'decOffset', 'spatialmodel', 'internalExtinctionModel', 'galacticExtinctionModel', 'galacticAv', 'galacticRv'] @@ -43,8 +43,8 @@ def get_inProtoDc2(self): def column_by_name(self, colname): if (self.disable_proper_motion and - (colname.startswith('properMotion') - or colname == 'radialVelocity')): + colname in ('properMotionRa', 'properMotionDec', + 'radialVelocity', 'parallax')): return np.zeros(len(self.column_by_name('raJ2000')), dtype=np.float) return super(MaskedPhoSimCatalogPoint, self).column_by_name(colname) @@ -81,9 +81,11 @@ def get_isBright(self): help='the minimum magintude for stars') parser.add_argument('--fov', type=float, default=2.0, help='field of view radius in degrees') - parser.add_argument('--disable_proper_motion', default=False, + parser.add_argument('--enable_proper_motion', default=False, action='store_true', - help='flag to disable proper motion') + help='flag to enable proper motion') + parser.add_argument('--minsource', type=int, default=100, + help='mininum number of objects in a trimmed instance catalog') args = parser.parse_args() obshistid_list = args.id @@ -138,6 +140,7 @@ def get_isBright(self): cat.phoSimHeaderMap = phosim_header_map with open(cat_name, 'w') as output: cat.write_header(output) + output.write('minsource %i\n' % args.minsource) output.write('includeobj %s.gz\n' % star_name) output.write('includeobj %s.gz\n' % gal_name) #output.write('includeobj %s.gz\n' % agn_name) @@ -147,7 +150,7 @@ def get_isBright(self): star_cat.phoSimHeaderMap = phosim_header_map bright_cat = BrightStarCatalog(star_db, obs_metadata=obs, cannot_be_null=['isBright']) star_cat.min_mag = args.min_mag - star_cat.disable_proper_motion = args.disable_proper_motion + star_cat.disable_proper_motion = not args.enable_proper_motion bright_cat.min_mag = args.min_mag from lsst.sims.catalogs.definitions import parallelCatalogWriter @@ -168,7 +171,7 @@ def get_isBright(self): for orig_name in (star_name, gal_name): full_name = os.path.join(out_dir, orig_name) - with open(full_name, 'r') as input_file: + with open(full_name, 'rb') as input_file: with gzip.open(full_name+'.gz', 'wb') as output_file: output_file.writelines(input_file) os.unlink(full_name) diff --git a/scripts/protoDC2/protoDC2_valid_obsids.py b/scripts/protoDC2/protoDC2_valid_obsids.py index f92dca6..9f9a363 100644 --- a/scripts/protoDC2/protoDC2_valid_obsids.py +++ b/scripts/protoDC2/protoDC2_valid_obsids.py @@ -2,16 +2,17 @@ import numpy as np import pandas as pd from lsst.sims.catUtils.utils import ObservationMetaDataGenerator +from lsst.sims.utils import angularSeparation def fov_overlaps_protoDC2(x, y, half_size=2.5, radius=1.77): if x > half_size and y > half_size: - return (x - half_size)**2 + (y - half_size)**2 < radius**2 + return angularSeparation(x, y, half_size, half_size) < radius elif x < -half_size and y > half_size: - return (x + half_size)**2 + (y - half_size)**2 < radius**2 + return angularSeparation(x, y, -half_size, half_size) < radius elif x < -half_size and y < -half_size: - return (x + half_size)**2 + (y + half_size)**2 < radius**2 + return angularSeparation(x, y, -half_size, -half_size) < radius elif x > half_size and y < -half_size: - return (x - half_size)**2 + (y + half_size)**2 < radius**2 + return angularSeparation(x, y, half_size, -half_size) < radius outer_box_size = half_size + radius return (-outer_box_size < x and x < outer_box_size and -outer_box_size < y and y < outer_box_size) diff --git a/scripts/protoDC2/protoDC2_visits.pkl b/scripts/protoDC2/protoDC2_visits.pkl index ec417f6..00cb748 100644 Binary files a/scripts/protoDC2/protoDC2_visits.pkl and b/scripts/protoDC2/protoDC2_visits.pkl differ diff --git a/scripts/protoDC2/protoDC2_visits_i-band.txt b/scripts/protoDC2/protoDC2_visits_i-band.txt index 9066190..0bbe27e 100644 --- a/scripts/protoDC2/protoDC2_visits_i-band.txt +++ b/scripts/protoDC2/protoDC2_visits_i-band.txt @@ -970,6 +970,7 @@ 2162113 62766.144126 2166862 62773.106638 2166863 62773.107086 +2166865 62773.107982 2166894 62773.121169 2166899 62773.123574 2166900 62773.124024 @@ -1324,6 +1325,7 @@ 925559 60939.097217 925560 60939.097663 925563 60939.099003 +925594 60939.114832 925597 60939.116172 926425 60940.072799 926426 60940.073247