def value(self): values = [] for line in self.lines: comp = line["comp"] if comp.isVisible(): values.append(comp.value()) return attr.or_(*values)
def test_or_nesting(): a1 = SA1(1) a2 = SA2(2) a3 = SA3(3) a = attr.or_(a1, attr.AttrOr((a2, a3))) # Test that the nesting has been removed. assert len(a.attrs) == 3
def query_or(draw, stattrs=st.lists(st.sampled_from(_supported_attr_types()), min_size=1, unique=True)): """ Just OR a lot of attrs together. """ attr_types = draw(stattrs) query_attrs = list(map(draw, map(st.from_type, attr_types))) assume(not (any(isinstance(q, a.Time) for q in query_attrs))) return attr.or_(*query_attrs)
import astropy.units as u from sunpy.net import Fido from sunpy.net import attrs as a from sunpy.time import parse_time from sunpy.net.attr import or_ times = map(parse_time, ["2014-02-13", "2019-08-01"]) times = list(map(lambda t: a.Time(t, t+1*u.day, t), times)) times = or_(*times) results = Fido.search(a.Instrument("HMI"), a.vso.Physobs("intensity"), times) print(results) files = Fido.fetch(results, path="./data/{file}") files = sorted(files) print(files)
def test_or_nesting(): a = attr.or_(attrs.Instrument('a'), attr.AttrOr((attrs.Instrument('b'), attrs.Instrument('c')))) # Test that the nesting has been removed. assert len(a.attrs) == 3
def query_or_composite(draw, qands=st.lists(query_and(), min_size=2, max_size=5)): """ Make a more realistic OR of ANDs. """ return attr.or_(*draw(qands))