Skip to content

Commit ee0e9d1

Browse files
authored
Merge pull request #4628 from cshallue/master
Merge internal changes
2 parents b54b536 + f27ec7f commit ee0e9d1

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

research/astronet/astronet/data/generate_download_script.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import argparse
3434
import csv
3535
import os
36+
import stat
3637
import sys
3738

3839
parser = argparse.ArgumentParser()
@@ -90,7 +91,9 @@ def main(argv):
9091
f.write("echo 'Finished downloading {} Kepler targets to {}'\n".format(
9192
num_kepids, FLAGS.download_dir))
9293

93-
os.chmod(FLAGS.output_file, 0o744) # Make the download script executable.
94+
# Make the download script executable.
95+
os.chmod(FLAGS.output_file, stat.S_IRWXU | stat.S_IRGRP | stat.S_IROTH)
96+
9497
print("{} Kepler targets will be downloaded to {}".format(
9598
num_kepids, FLAGS.output_file))
9699
print("To start download, run:\n {}".format("./" + FLAGS.output_file

research/astronet/astronet/ops/dataset_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def build_dataset(file_pattern,
193193
table_initializer, default_value=-1)
194194

195195
def _example_parser(serialized_example):
196-
"""Parses a single tf.Example into image and label tensors."""
196+
"""Parses a single tf.Example into feature and label tensors."""
197197
# Set specifications for parsing the features.
198198
data_fields = {
199199
feature_name: tf.FixedLenFeature([feature.length], tf.float32)

research/astronet/light_curve_util/periodic_event.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ def __init__(self, period, duration, t0):
3636
self._duration = duration
3737
self._t0 = t0
3838

39+
def __str__(self):
40+
return "<period={}, duration={}, t0={}>".format(self.period, self.duration,
41+
self.t0)
42+
43+
def __repr__(self):
44+
return "Event({})".format(str(self))
45+
3946
@property
4047
def period(self):
4148
return self._period

research/astronet/light_curve_util/periodic_event_test.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525

2626
class EventTest(absltest.TestCase):
2727

28+
def testStr(self):
29+
self.assertEqual(str(Event(1, 2, 3)), "<period=1, duration=2, t0=3>")
30+
31+
def testRepr(self):
32+
self.assertEqual(
33+
repr(Event(1, 2, 3)), "Event(<period=1, duration=2, t0=3>)")
34+
2835
def testEquals(self):
2936
event = Event(period=100, duration=5, t0=2)
3037

@@ -72,5 +79,5 @@ def testEquals(self):
7279
event.equals(Event(period=100, duration=5, t0=10), t0_durations=2))
7380

7481

75-
if __name__ == '__main__':
82+
if __name__ == "__main__":
7683
absltest.main()

0 commit comments

Comments
 (0)