Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Here is a snippet: <|code_start|> assert bs > 0 return bs @property def nsites(self): """See docs for `Model` abstract base class.""" return self._nsites @property def freeparams(self): """See docs for `Model` abstract base class.""" return self._freepara...
for x in range(N_STOP):
Given the following code snippet before the placeholder: <|code_start|> Element `r` is diagonal of :math:`\mathbf{D_r}` diagonal matrix, :math:`\mathbf{P_r} = \mathbf{A_r}^{-1} \mathbf{D_r} \mathbf{A_r}` `A` (`numpy.ndarray` floats, shape `(nsites, N_CODON, N_CODON)`) Element ...
'eta': (numpy.ndarray, (N_NT - 1,)),
Given snippet: <|code_start|> minimum value for {0}, {1}, is equal to or \ larger than the new maximum value, {2}"\ .format(param, value[param][0], value[param][1]) self._PARAMLIMITS = value.copy() def __init__(self, prefs, kappa=2.0, omega=0.5, be...
self.pi = numpy.ndarray((self.nsites, N_AA), dtype='float')
Here is a snippet: <|code_start|> @property def logprior(self): """Is zero, as no prior is defined over this model.""" return 0.0 def dlogprior(self, param): """Zero for all `param`, as no prior defined over this model.""" assert param in self.freeparams, "Invalid param: {0}...
report['{0}{1}'.format(param, INDEX_TO_NT[w])] = pvalue[w]
Next line prediction: <|code_start|> for j in range(paramlength): dM_param[j] = (broadcastMatrixVectorMultiply(self.A, broadcastGetCols(broadcastMatrixMultiply(self.B[param][j] * V, self.Ainv), tips))) # noqa: E501 if gap...
numpy.copyto(self.Qxy, self.phi[w], where=CODON_NT_MUT[w])
Using the snippet: <|code_start|> self.beta, dx=dbeta, n=1, order=5) dphi_dbeta_halfdx = scipy.misc.derivative(self._compute_empirical_phi, self.beta, dx=dbeta / 2, ...
phiprod *= phifull[w]**CODON_NT_COUNT[w]
Using the snippet: <|code_start|> for w in range(N_NT - 1): self.eta[w] = 1.0 - self.phi[w] / etaprod etaprod *= self.eta[w] _checkParam('eta', self.eta, self.PARAMLIMITS, self.PARAMTYPES) def _update_phi(self): """Update `phi` using current `eta`.""" etaprod ...
self.pi_codon[r] = self.pi[r][CODON_TO_AA]
Here is a snippet: <|code_start|> Args: `prefs` (list) List of dicts giving amino-acid preferences for each site. Each dict keyed by amino acid letter codes, value is pref > 0 and < 1. Must sum to 1 at each site. `kappa`, `o...
for (a, aa) in INDEX_TO_AA.items():
Here is a snippet: <|code_start|> def __init__(self, prefs, kappa=2.0, omega=0.5, beta=1.0, mu=1.0, phi=numpy.ones(N_NT) / N_NT, freeparams=('kappa', 'omega', 'beta', 'mu', 'eta')): """Initialize an `ExpCM` object. Args: `prefs` (list) Li...
assert set(prefs[r].keys()) == set(AA_TO_INDEX.keys()),\
Given the code snippet: <|code_start|> where=CODON_NONSYN) def _update_Prxy(self): """Update `Prxy` using current `Frxy` and `Qxy`.""" self.Prxy = self.Frxy * self.Qxy _fill_diagonals(self.Prxy, self._diag_indices) def _update_Prxy_diag(self): """Update `D`,...
qx[CODON_NT[j][w]] *= self.phi[w]
Predict the next line for this snippet: <|code_start|> kappa=self.kappa, omega=self.omega, mu=10.0, phi=self.phi) treefi...
self.aacounts[r][CODON_TO_AA[CODON_TO_INDEX[seq[i: i+3]]]] += 1
Given the code snippet: <|code_start|> kappa=self.kappa, omega=self.omega, mu=10.0, phi=self.phi) treefile = os.path.abs...
self.aacounts[r][CODON_TO_AA[CODON_TO_INDEX[seq[i: i+3]]]] += 1
Predict the next line after this snippet: <|code_start|>Written by Jesse Bloom. """ class test_TreeLikelihood_ExpCM_fitprefs(unittest.TestCase): """Test `ExpCM_fitprefs` in `TreeLikelihood`.""" MODEL = phydmslib.models.ExpCM_fitprefs def setUp(self): """Set up for tests.""" numpy.rando...
self.phi = numpy.random.dirichlet([5] * N_NT)
Predict the next line for this snippet: <|code_start|>"""Tests `TreeLikelihood` with `ExpCM_fitprefs` and `ExpCM_fitprefs2`. Written by Jesse Bloom. """ class test_TreeLikelihood_ExpCM_fitprefs(unittest.TestCase): """Test `ExpCM_fitprefs` in `TreeLikelihood`.""" MODEL = phydmslib.models.ExpCM_fitprefs ...
rprefs = numpy.random.dirichlet([0.5] * N_AA)
Given the code snippet: <|code_start|> self.model = self.MODEL(self.prefs, prior=None, kappa=self.kappa, omega=self.omega, phi=self.phi) self.realmodel = phydmslib.models.ExpCM(...
self.codoncounts = {r: {INDEX_TO_CODON[c]: 0 for c in range(N_CODON)}
Continue the code snippet: <|code_start|>"""Tests `TreeLikelihood` with `ExpCM_fitprefs` and `ExpCM_fitprefs2`. Written by Jesse Bloom. """ class test_TreeLikelihood_ExpCM_fitprefs(unittest.TestCase): """Test `ExpCM_fitprefs` in `TreeLikelihood`.""" MODEL = phydmslib.models.ExpCM_fitprefs def setUp(s...
self.prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs)))
Next line prediction: <|code_start|> self.model = self.MODEL(self.prefs, prior=None, kappa=self.kappa, omega=self.omega, phi=self.phi) self.realmodel = phydmslib.models.ExpCM(se...
self.codoncounts = {r: {INDEX_TO_CODON[c]: 0 for c in range(N_CODON)}
Using the snippet: <|code_start|> self.assertTrue(numpy.allclose(kappa, self.expcm.kappa)) self.assertTrue(numpy.allclose(beta, self.expcm.beta)) self.assertTrue( numpy.allclose( numpy.repeat(1.0, self.nsites), self.expcm.stationarystate.sum(axis=1))) ...
diag = numpy.eye(N_CODON, dtype="bool")
Continue the code snippet: <|code_start|> self.expcm.Prxy[r]))) if r > 0: self.assertFalse( numpy.allclose( 0, numpy.dot(self.expcm.prx[r], self.expcm.Prxy[r - 1]))) def check_ExpCM_derivat...
w = NT_TO_INDEX[
Given the following code snippet before the placeholder: <|code_start|> self.assertTrue(numpy.allclose(1, self.expcm.prx[r].sum())) # prx is eigenvector or Prxy for the same r, but not different r for r in range(self.nsites): self.assertTrue( numpy.allclose(0, num...
pirAx = self.prefs[r][INDEX_TO_AA[CODON_TO_AA[x]]]
Here is a snippet: <|code_start|> if r > 0: self.assertFalse( numpy.allclose( 0, numpy.dot(self.expcm.prx[r], self.expcm.Prxy[r - 1]))) def check_ExpCM_derivatives(self): """Use `sympy` to check values & derivati...
[ynt for (xnt, ynt) in zip(INDEX_TO_CODON[x],
Continue the code snippet: <|code_start|> self.assertTrue(numpy.allclose(1, self.expcm.prx[r].sum())) # prx is eigenvector or Prxy for the same r, but not different r for r in range(self.nsites): self.assertTrue( numpy.allclose(0, numpy.dot(self.expcm.prx[r], ...
pirAx = self.prefs[r][INDEX_TO_AA[CODON_TO_AA[x]]]
Using the snippet: <|code_start|> for r in range(self.nsites): self.assertTrue( numpy.allclose(0, numpy.dot(self.expcm.prx[r], self.expcm.Prxy[r]))) if r > 0: self.assertFalse( numpy.allclose( ...
if not CODON_SINGLEMUT[x][y]:
Given the code snippet: <|code_start|> "eta0": self.params["eta"][0], "eta1": self.params["eta"][1], "eta2": self.params["eta"][2]} # check Prxy for r in range(self.nsites): for x in range(N_CODON): pirAx = self.prefs[r][I...
if CODON_TRANSITION[x][y]:
Predict the next line after this snippet: <|code_start|> pirAx = self.prefs[r][INDEX_TO_AA[CODON_TO_AA[x]]] for y in [yy for yy in range(N_CODON) if yy != x]: pirAy = self.prefs[r][INDEX_TO_AA[CODON_TO_AA[y]]] if not CODON_SINGLEMUT[x][y]: ...
if CODON_NONSYN[x][y]:
Given snippet: <|code_start|>"""Tests `phydmslib.models.ExpCM` class. Written by Jesse Bloom. Uses `sympy` to make sure attributes and derivatives of attributes are correct for `ExpCM` implemented in `phydmslib.models`. """ class testExpCM(unittest.TestCase): """Tests ``ExpCM`` model.""" def test_ExpCM(s...
phi = numpy.random.dirichlet([2] * N_NT)
Predict the next line after this snippet: <|code_start|>"""Tests `phydmslib.models.ExpCM` class. Written by Jesse Bloom. Uses `sympy` to make sure attributes and derivatives of attributes are correct for `ExpCM` implemented in `phydmslib.models`. """ class testExpCM(unittest.TestCase): """Tests ``ExpCM`` mode...
self.prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs)))
Continue the code snippet: <|code_start|>"""Tests `phydmslib.models.ExpCM` class. Written by Jesse Bloom. Uses `sympy` to make sure attributes and derivatives of attributes are correct for `ExpCM` implemented in `phydmslib.models`. """ class testExpCM(unittest.TestCase): """Tests ``ExpCM`` model.""" def ...
rprefs = numpy.random.dirichlet([0.5] * N_AA)
Predict the next line after this snippet: <|code_start|>"""Tests invquadratic prior in `ExpCM_fitprefs`. Written by Jesse Bloom. """ class test_fitprefs_invquadraticprior(unittest.TestCase): """Test `ExpCM_fitprefs` with inverse quadratic prior.""" MODEL = phydmslib.models.ExpCM_fitprefs def setUp(se...
rprefs = numpy.random.dirichlet([0.7] * N_AA)
Next line prediction: <|code_start|>"""Tests invquadratic prior in `ExpCM_fitprefs`. Written by Jesse Bloom. """ class test_fitprefs_invquadraticprior(unittest.TestCase): """Test `ExpCM_fitprefs` with inverse quadratic prior.""" MODEL = phydmslib.models.ExpCM_fitprefs def setUp(self): """Set ...
phi=numpy.random.dirichlet([5] * N_NT)
Based on the snippet: <|code_start|>"""Tests invquadratic prior in `ExpCM_fitprefs`. Written by Jesse Bloom. """ class test_fitprefs_invquadraticprior(unittest.TestCase): """Test `ExpCM_fitprefs` with inverse quadratic prior.""" MODEL = phydmslib.models.ExpCM_fitprefs def setUp(self): """Set ...
self.prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs)))
Next line prediction: <|code_start|> beta=beta, omega2=omega2) # now check ExpCM attributes / derivates, updating several times for _update in range(2): self.params = { "omega": random.uniform(0.1, 2), "kappa": random.uniform(0.5, 10), ...
for x in range(N_CODON):
Based on the snippet: <|code_start|>"""Tests `phydmslib.models.ExpCM_empirical_phi_divpressure` class. Written by Jesse Bloom. Edited by Sarah Hilton """ class test_compare_ExpCM_emp_phi_with_without_divpress(unittest.TestCase): """Tests ``ExpCM`` with and without div pressure.""" def test_compare(self): ...
g = numpy.random.dirichlet([3] * N_NT)
Predict the next line for this snippet: <|code_start|>"""Tests `phydmslib.models.ExpCM_empirical_phi_divpressure` class. Written by Jesse Bloom. Edited by Sarah Hilton """ class test_compare_ExpCM_emp_phi_with_without_divpress(unittest.TestCase): """Tests ``ExpCM`` with and without div pressure.""" def te...
prefs.append(dict(zip(sorted(AA_TO_INDEX.keys()), rprefs)))
Next line prediction: <|code_start|>"""Tests `phydmslib.models.ExpCM_empirical_phi_divpressure` class. Written by Jesse Bloom. Edited by Sarah Hilton """ class test_compare_ExpCM_emp_phi_with_without_divpress(unittest.TestCase): """Tests ``ExpCM`` with and without div pressure.""" def test_compare(self): ...
rprefs = numpy.random.dirichlet([0.5] * N_AA)
Next line prediction: <|code_start|> # now check ExpCM attributes / derivates, updating several times for _update in range(2): self.params = { "omega": random.uniform(0.1, 2), "kappa": random.uniform(0.5, 10), "beta": random.uniform(0.5, 3), ...
nt_freqs[w] += self.model.prx[r][x] * CODON_NT_COUNT[w][x]
Given the following code snippet before the placeholder: <|code_start|> subject = ("ITP: bugwarrior -- Pull tickets from github, " "bitbucket, bugzilla, jira, trac, and others into " "taskwarrior") severity = "wishlist" source = "" forwarded = "" pending = "pending" cl...
self.service = self.get_mock_service(bts.BTSService)
Here is a snippet: <|code_start|> class FakeBTSBug: bug_num = 810629 package = "wnpp" subject = ("ITP: bugwarrior -- Pull tickets from github, " "bitbucket, bugzilla, jira, trac, and others into " "taskwarrior") severity = "wishlist" source = "" forwarded = "" ...
class TestBTSService(AbstractServiceTest, ServiceTest):
Based on the snippet: <|code_start|> class FakeBTSBug: bug_num = 810629 package = "wnpp" subject = ("ITP: bugwarrior -- Pull tickets from github, " "bitbucket, bugzilla, jira, trac, and others into " "taskwarrior") severity = "wishlist" source = "" forwarded = ""...
class TestBTSService(AbstractServiceTest, ServiceTest):
Next line prediction: <|code_start|> class TestTaigaIssue(AbstractServiceTest, ServiceTest): SERVICE_CONFIG = { 'service': 'taiga', 'taiga.base_uri': 'https://one', 'taiga.auth_token': 'two', } record = { 'id': 400, 'project': 4, 'ref': 40, 'subject...
self.service = self.get_mock_service(TaigaService)
Based on the snippet: <|code_start|> class TestGerritIssue(AbstractServiceTest, ServiceTest): SERVICE_CONFIG = { 'service': 'gerrit', 'gerrit.base_uri': 'https://one.com', 'gerrit.username': 'two', 'gerrit.password': 'three', } record = { 'project': 'nova', ...
self.service = self.get_mock_service(GerritService)
Based on the snippet: <|code_start|> "id": 35546, "name": "Adam Coddington" }, "created_on": arbitrary_created.isoformat(), "due_on": "2016-12-30T16:40:29Z", "description": "This is a test issue.", "done_ratio": 0, "id": 363901, "priority": ...
self.service = self.get_mock_service(RedMineService)
Given snippet: <|code_start|> class StringCompatTest(unittest.TestCase): """This class implements method to test correct and compatible implementation of __str__ and __repr__ methods""" def test_issue_str(self): "check Issue class" record = {} origin = {'target': 'target', ...
issue = DumbIssue(record, origin)
Given snippet: <|code_start|> if main_config.merge_tags: if main_config.replace_tags: replace_left('tags', task, issue_dict, main_config.static_tags) else: merge_left('tags', task, issue_dict) issue_dict.pop('annotations', N...
send_notification(issue, 'Created', conf['notifications'])
Predict the next line after this snippet: <|code_start|> arbitrary_issue = { 'priority': 0, 'project': 'something', 'due_on': { 'formatted_date': arbitrary_due_on.isoformat(), }, 'permalink': 'http://wherever/', 'task_id': 10, 'project_name': 'somet...
self.service = self.get_mock_service(ActiveCollabService)
Continue the code snippet: <|code_start|> class FakeActiveCollabLib: def __init__(self, arbitrary_issue): self.arbitrary_issue = arbitrary_issue def get_my_tasks(self): return {'arbitrary_key': {'assignments': { self.arbitrary_issue['task_id']: self.arbitrary_issue}}} def g...
class TestActiveCollabIssues(AbstractServiceTest, ServiceTest):
Given the following code snippet before the placeholder: <|code_start|> class FakeActiveCollabLib: def __init__(self, arbitrary_issue): self.arbitrary_issue = arbitrary_issue def get_my_tasks(self): return {'arbitrary_key': {'assignments': { self.arbitrary_issue['task_id']: self...
class TestActiveCollabIssues(AbstractServiceTest, ServiceTest):
Given the code snippet: <|code_start|> self.config.add_section('general') self.config.set('general', 'targets', 'my_service') self.config.set('general', 'static_fields', 'project, priority') self.config.set('general', 'taskrc', self.taskrc) self.config.add_section('my_service') ...
self.runner.invoke(command.pull, args=('--debug'))
Continue the code snippet: <|code_start|> def fake_github_issues(self): yield from [self.get_issue_for_record(ARBITRARY_ISSUE, ARBITRARY_EXTRA)] def fake_bz_issues(self): yield from [{ 'annotations': [], 'bugzillabugid': 1234567, 'bugzillastatus': 'NEW', 'bu...
self.config = BugwarriorConfigParser()
Predict the next line for this snippet: <|code_start|> def fake_github_issues(self): yield from [self.get_issue_for_record(ARBITRARY_ISSUE, ARBITRARY_EXTRA)] def fake_bz_issues(self): yield from [{ 'annotations': [], 'bugzillabugid': 1234567, 'bugzillastatus': 'NEW', ...
class TestPull(ConfigTest):
Predict the next line after this snippet: <|code_start|> 'activecollab2.projects': '1:one, 2:two' } arbitrary_due_on = ( datetime.datetime.now() - datetime.timedelta(hours=1) ).replace(tzinfo=pytz.UTC) arbitrary_created_on = ( datetime.datetime.now() - datetime.timedelta(hours=2)...
self.service = self.get_mock_service(ActiveCollab2Service)
Using the snippet: <|code_start|> class TestLoggingPath(unittest.TestCase): def setUp(self): self.dir = os.getcwd() os.chdir(os.path.expanduser('~')) def test_log_relative_path(self): self.assertEqual( <|code_end|> , determine the next line of code. You have imports: import os impor...
schema.LoggingPath.validate('bugwarrior.log'),
Based on the snippet: <|code_start|> ) def test_log_envvar(self): self.assertEqual( schema.LoggingPath.validate('$HOME/bugwarrior.log'), 'bugwarrior.log', ) def tearDown(self): os.chdir(self.dir) class TestConfigList(unittest.TestCase): def test_con...
self.config = load.BugwarriorConfigParser()
Predict the next line for this snippet: <|code_start|> self.assertEqual( schema.LoggingPath.validate('~/bugwarrior.log'), 'bugwarrior.log', ) def test_log_envvar(self): self.assertEqual( schema.LoggingPath.validate('$HOME/bugwarrior.log'), 'bug...
class TestValidation(ConfigTest):
Given the code snippet: <|code_start|> class TestTeamworkIssue(AbstractServiceTest, ServiceTest): SERVICE_CONFIG = { 'service': 'teamwork_projects', 'teamwork_projects.host': 'https://test.teamwork_projects.com', 'teamwork_projects.token': 'arbitrary_token', } @responses.activate ...
self.service = self.get_mock_service(TeamworkService)
Based on the snippet: <|code_start|> class TestTemplates(ServiceTest): def setUp(self): super().setUp() self.arbitrary_default_description = 'Construct Library on Terminus' self.arbitrary_issue = { 'project': 'end_of_empire', 'priority': 'H', } def get_i...
issue = DumbIssue({}, origin)
Predict the next line for this snippet: <|code_start|> class TestTeamlabIssue(AbstractServiceTest, ServiceTest): SERVICE_CONFIG = { 'service': 'teamlab', 'teamlab.hostname': 'something', 'teamlab.login': 'alkjdsf', 'teamlab.password': 'lkjklj', 'teamlab.project_name': 'ab...
self.service = self.get_mock_service(TeamLabService)
Given snippet: <|code_start|> class TestGetConfigPath(ConfigTest): def create(self, path): """ Create an empty file in the temporary directory, return the full path. """ fpath = os.path.join(self.tempdir, path) if not os.path.exists(os.path.dirname(fpath)): os...
self.assertEqual(load.get_config_path(), rc)
Given snippet: <|code_start|> class TestData(ConfigTest): def setUp(self): super().setUp() <|code_end|> , continue by predicting the next line. Consider current file imports: import os import json from bugwarrior.config import data, load, schema from ..base import ConfigTest and context: # Path: bugwa...
self.data = data.BugwarriorData(self.lists_path)
Next line prediction: <|code_start|> permissions = oct(os.stat(self.data.datafile).st_mode & 0o777) # python2 -> 0600, python3 -> 0o600 self.assertIn(permissions, ['0600', '0o600']) def test_get_set(self): # "touch" data file. with open(self.data.datafile, 'w+') as handle: ...
rawconfig = load.BugwarriorConfigParser()
Here is a snippet: <|code_start|> self.data.set('key', 'value') self.assertEqual(self.data.get('key'), 'value') self.assertEqual( self.data.get_data(), {'old': 'stuff', 'key': 'value'}) self.assert0600() def test_set_first_time(self): self.data.set('key', 'value...
self.config = schema.validate_config(
Using the snippet: <|code_start|> server = FakeTracServer() def __init__(self, record): self.record = record @staticmethod def query_tickets(query): return ['something'] def get_ticket(self, ticket): return (1, None, None, self.record) class TestTracIssue(AbstractServiceT...
self.service = self.get_mock_service(TracService)
Given the following code snippet before the placeholder: <|code_start|> class FakeTracTicket: @staticmethod def changeLog(issuenumber): return [] class FakeTracServer: ticket = FakeTracTicket() class FakeTracLib: server = FakeTracServer() def __init__(self, record): self.recor...
class TestTracIssue(AbstractServiceTest, ServiceTest):
Next line prediction: <|code_start|> class FakeTracTicket: @staticmethod def changeLog(issuenumber): return [] class FakeTracServer: ticket = FakeTracTicket() class FakeTracLib: server = FakeTracServer() def __init__(self, record): self.record = record @staticmethod d...
class TestTracIssue(AbstractServiceTest, ServiceTest):
Based on the snippet: <|code_start|>#!/usr/bin/env python """Perform object finding and association.""" components = ['label','objects','associate','candidate','plot','www'] def load_candidates(filename,threshold=0): """ Load candidates for plotting """ candidates = fitsio.read(filename,lower=True,trim_str...
logger.info("Running 'label'...")
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python try: except ImportError: DATABASES = { 'sdss':['dr10'], 'des' :['sva1','sva1_gold','y1a1','y2n','y2q1'], } def databaseFactory(survey,release): if survey == 'sdss': return SDSSDatabase(release = r...
logger.error("Unrecognized survey: %s"%survey)
Predict the next line after this snippet: <|code_start|> matplotlib.use('Agg') #try: os.environ['DISPLAY'] #except KeyError: matplotlib.use('Agg') components = ['mcmc','membership','results','plot','collect','scan'] components = ['mcmc','membership','results','plot'] def make_filenames(config,label): ...
logger.warning("Couldn't find %s; skipping..."%srcfile)
Based on the snippet: <|code_start|> return np.savetxt(filename,data,header=','.join(data.dtype.names),delimiter=',',**kwargs) elif ext in ('.txt','.dat'): return np.savetxt(filename,data,**kwargs) msg = "Unrecognized file type: %s"%filename raise ValueError(msg) def check_formula(formula):...
logger.info("Running file: %s"%filename)
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python """ Simulate the likelihood search. """ #components = ['simulate','analyze','merge','plot'] components = ['analyze','merge'] def run(self): outdir=mkdir(self.config['output']['simdir']) logdir=mkdir(join(outdir,'log')) # Act...
logger.info("Running 'simulate'...")
Continue the code snippet: <|code_start|> Initialize a configuration object from a filename or a dictionary. Provides functionality to merge with a default configuration. Parameters: config: filename, dict, or Config object (deep copied) default: default configuration to m...
logger.warning("%s %s"%(exc_type,exc_value))
Next line prediction: <|code_start|> (10,('r',float)), (11,('i',float)), (12,('z',float)), (13,('y',float)), (16,('stage',float)) ]), lsst = odict([ (2, ('mass_init',float)), (3, ('...
logger.warning('Unrecognized survey: %s'%(self.survey))
Using the snippet: <|code_start|># MESA Isochrones # http://waps.cfa.harvard.edu/MIST/iso_form.php # survey system dict_output = odict([ ('des','DECam'), ('sdss','SDSSugriz'), ('ps1','PanSTARRS'), ('lsst','LSST'), ]) mesa_defaults = { 'version':'1.0', 'v_div_vcrit':'vvcrit...
class Dotter2016(Isochrone):
Continue the code snippet: <|code_start|>dict_output = odict([ ('des','DECam'), ('sdss','SDSSugriz'), ('ps1','PanSTARRS'), ('lsst','LSST'), ]) mesa_defaults = { 'version':'1.0', 'v_div_vcrit':'vvcrit0.4', 'age_scale':'linear', 'age_type':'single', 'a...
_dirname = os.path.join(get_iso_dir(),'{survey}','dotter2016')
Given the following code snippet before the placeholder: <|code_start|>class Projector: """ Class for performing two-dimensional map projections from the celestial sphere. """ def __init__(self, lon_ref, lat_ref, proj_type = 'ait'): self.lon_ref = lon_ref self.lat_ref = lat_ref ...
logger.warn('%s not recognized'%(proj_type))
Given the code snippet: <|code_start|>#!/usr/bin/env python if __name__ == "__main__": usage = "Usage: %prog [options] results1.fits results2.fits ... " description = "Script for merging multiple results files." parser = OptionParser(usage=usage,description=description) parser.add_option('-o','--outf...
if opts.verbose: logger.setLevel(logger.DEBUG)
Given snippet: <|code_start|> ------- None """ assert mc_source_id_start >= 1, "Starting mc_source_id must be >= 1" assert n % n_chunk == 0, "Total number of satellites must be divisible by the chunk size" nside_pix = 256 # NSIDE = 128 -> 27.5 arcmin, NSIDE = 256 -> 13.7 arcmin if not...
m_fracdet = read_map(infile_fracdet, nest=False) #.astype(np.float16)
Given the code snippet: <|code_start|> for k,v in header.items(): fitshdr.add_record({'name':k,'value':v}) # ADW: Should this be a debug? logger.info("Writing %s..."%filename) fitsio.write(filename,data,extname='PIX_DATA',header=fitshdr,clobber=True) def read_partial_map(filenames, colum...
data = fileio.load_files(filenames,**kwargs)
Based on the snippet: <|code_start|> ----------- filename : output file name data : dictionary or recarray of data to write (must contain 'PIXEL') nside : healpix nside of data coord : 'G'alactic, 'C'elestial, 'E'cliptic ordering : 'RING' or 'NEST' kwargs : Passed to fitsio.write ...
logger.info("Writing %s..."%filename)
Predict the next line for this snippet: <|code_start|> 'output_kind': 0, 'photsys_file': photsys_dict['des'], #'photsys_version': 'yang', 'submit_form': 'Submit'} defaults_27 = dict(defaults_cmd,cmd_version='2.7') defaults_28 = dict(defaults_cmd,cmd_versio...
logger.info(msg)
Continue the code snippet: <|code_start|>#!/usr/bin/env python """Run the likelihood search.""" components = ['scan','merge','tar','plot','check'] defaults = ['scan','merge'] def run(self): if 'scan' in self.opts.run: <|code_end|> . Use current file imports: import glob import os import numpy as np import uga...
logger.info("Running 'scan'...")
Based on the snippet: <|code_start|>#!/usr/bin/env python """Run the likelihood search.""" components = ['scan','merge','tar','plot','check'] defaults = ['scan','merge'] def run(self): if 'scan' in self.opts.run: logger.info("Running 'scan'...") farm = Farm(self.config,verbose=self.opts.verbose...
superpixel = healpix.superpixel(pixels,
Predict the next line after this snippet: <|code_start|>NSIDE = 4096 FACTOR = 4 PIX = np.array([104582830, 43361203, 142027178]) U_GRADE_PIX_NEST = np.array([[418331320, 418331321, 418331322, 418331323], [173444812, 173444813, 173444814, 173444815], [568108712,...
np.testing.assert_equal(healpix.ud_grade_ipix(PIX,NSIDE,NSIDE),PIX)
Predict the next line after this snippet: <|code_start|> if opts.verbose: logger.setLevel(logger.DEBUG) map = ugali.utils.skymap.readSparseHealpixMaps(args,opts.field) if opts.coord.upper() == "GAL": coord = 'G' elif opts.coord.upper() == "CEL": coord = 'GC' if opts.proj.upper() == "...
glon,glat = celToGal(target[1],target[2])
Next line prediction: <|code_start|>leo_II = ["Leo II" ,dict(default_kwargs,xytext=(-4,0),ha='right'), ], leo_IV = ["Leo IV" ,dict(default_kwargs,xytext=(5,-1),ha='left'), ], leo_T = ["Leo T" ,dict(default_kwargs,xytext=(4,5),ha='left'), ], leo_V = ["Leo V" ,dic...
if opts.verbose: logger.setLevel(logger.DEBUG)
Here is a snippet: <|code_start|>#!/usr/bin/env python #import mangle if __name__ == "__main__": usage = "Usage: %prog [options] mangle1.ply [mangle2.ply ...]" description = "python script" parser = OptionParser(usage=usage,description=description) (opts, args) = parser.parse_args() nside = 2**8...
inside = inMangle(infile,ra,dec)
Given the following code snippet before the placeholder: <|code_start|>#!/usr/bin/env python #import mangle if __name__ == "__main__": usage = "Usage: %prog [options] mangle1.ply [mangle2.ply ...]" description = "python script" parser = OptionParser(usage=usage,description=description) (opts, args) =...
ra,dec = pixToAng(nside,pix)
Predict the next line for this snippet: <|code_start|>""" Documentation. """ pylab.ion() ############################################################ def validateSatellite(config, isochrone, kernel, stellar_mass, distance_modulus, trials=1, debug=False, seed=0): """ Tool for simple MC validation studies -...
logger.info('=== Validate Satellite ===')
Here is a snippet: <|code_start|> epsilon = 1.e-10 if config.params['catalog']['band_1_detection']: bins_mag_1 = numpy.arange(config.params['mag']['min'] - mag_buffer, config.params['mag']['max'] + mag_buffer + epsilon, delta_mag) ...
logger.debug('(%i/%i)'%(index_distance_modulus, len(distance_modulus_array)))
Here is a snippet: <|code_start|> def add_seed(self,**kwargs): self.add_argument('--seed',default=None,type=int, help='Random seed.',**kwargs) def add_version(self,**kwargs): self.add_argument('-V','--version',action='version', version='ugali '...
gal = pix2ang(*opts.hpx)
Continue the code snippet: <|code_start|> help='Force the overwrite of files',**kwargs) def add_seed(self,**kwargs): self.add_argument('--seed',default=None,type=int, help='Random seed.',**kwargs) def add_version(self,**kwargs): self.add_argum...
gal = cel2gal(*opts.cel)
Next line prediction: <|code_start|> help="Batch queue for execution.",**kwargs) def add_ncores(self,**kwargs): self.add_argument('--ncores', help="Number of cores to use.",**kwargs) def add_config(self,**kwargs): sel...
logger.setLevel(logger.DEBUG)
Using the snippet: <|code_start|> 'FeH_value':-3.0, 'theory_output':'basic', 'output_option':'photometry', 'output':'DECam', 'Av_value':0, } mesa_defaults_10 = dict(mesa_defaults,version='1.0') class Dotter2008(Download): """ Dartmouth isochrones from Dotter et al. 2008: ...
logger.debug(query)
Based on the snippet: <|code_start|># MESA Isochrones # http://waps.cfa.harvard.edu/MIST/iso_form.php # survey system dict_output = odict([ ('des' ,'DECam'), ('sdss','SDSSugriz'), ('ps1' ,'PanSTARRS'), ('lsst','LSST'), ]) mesa_defaults = { 'version':'1.0', 'v_div_vcrit':'vvcri...
class Dotter2008(Download):
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python #CATALOGS = ['McConnachie12','Rykoff14', 'Harris96', 'Corwen04', 'Nilson73', 'Webbink85', 'Kharchenko13', 'WEBDA14'] CATALOGS = ['McConnachie12', 'Harris96', 'Corwen04', 'Nilson73', 'Webbink85', 'Kharchenko13', 'Bica08', 'WEBDA14', 'ExtraDwa...
ra,dec = gal2cel(glon,glat)
Next line prediction: <|code_start|>#!/usr/bin/env python #CATALOGS = ['McConnachie12','Rykoff14', 'Harris96', 'Corwen04', 'Nilson73', 'Webbink85', 'Kharchenko13', 'WEBDA14'] CATALOGS = ['McConnachie12', 'Harris96', 'Corwen04', 'Nilson73', 'Webbink85', 'Kharchenko13', 'Bica08', 'WEBDA14', 'ExtraDwarfs','ExtraClusters'...
const = ang2const(glon,glat)[0]
Using the snippet: <|code_start|>#!/usr/bin/env python #CATALOGS = ['McConnachie12','Rykoff14', 'Harris96', 'Corwen04', 'Nilson73', 'Webbink85', 'Kharchenko13', 'WEBDA14'] CATALOGS = ['McConnachie12', 'Harris96', 'Corwen04', 'Nilson73', 'Webbink85', 'Kharchenko13', 'Bica08', 'WEBDA14', 'ExtraDwarfs','ExtraClusters'] ...
iau = ang2iau(glon,glat)
Based on the snippet: <|code_start|> ra1950 = ugali.utils.projector.hms2dec(ra) dec1950 = ugali.utils.projector.dms2dec(dec) ra2000,dec2000 = ugali.utils.idl.jprecess(ra1950,dec1950) self.data['ra'] = ra2000 self.data['dec'] = dec2000 glon,glat = cel2gal(self.data['ra'],s...
ra,dec = gal2cel(self.data['glon'],self.data['glat'])
Given the code snippet: <|code_start|> if np.isnan([self.data['glon'],self.data['glat']]).any(): raise ValueError("Incompatible values") def __getitem__(self, key): """ Support indexing, slicing and direct access. """ try: return self.data[key] ...
glon, glat = cel2gal(lon,lat)
Given the following code snippet before the placeholder: <|code_start|>class ExtraClusters(SourceCatalog): """ Collection of recently discovered star clusters """ def _load(self,filename): kwargs = dict(delimiter=',') if filename is None: filename = os.path.join(self.DATADIR...
logger.error(msg)
Predict the next line after this snippet: <|code_start|> out = self.popen(cmd) stdout = out.communicate()[0] # There is an extra newline at the end return stdout.split('\n')[:-1] def bcomp(self, path): """ Return completed logfile(s). Parameters: ----------- ...
logger.info('%i jobs already in queue, waiting...'%(njobs))