Hi @AHsu98! I think the function `pull_set_rate_pattern` is a little confusing. Usually the setter and getter are separate. I recommend using `property` to create a setter and getter for `rate_pattern`:
class DisaggModel:
def __init__(self, ..., rate_pattern: Optional[NDArray] = None, ...):
self._rate_pattern = rate_pattern
@property
def rate_pattern(self) -> NDArray:
if self._rate_pattern is None:
raise ValueError("No Rate Pattern Available")
return self._rate_pattern
@rate_pattern.setter
def rate_pattern(self, rate_pattern: Optional[NDArray]):
if rate_pattern is not None:
self._rate_pattern = rate_pattern
def fit_beta(self, ...):
self.rate_pattern = rate_pattern
For more detail on setter and getter, please check https://realpython.com/python-getter-setter/#using-properties-instead-of-getters-and-setters-the-python-way
_Originally posted by @zhengp0 in https://github.com/ihmeuw-msca/pyDisagg/pull/20#discussion_r1113639606_