LBNL-ETA / pyWinCalc

Other
28 stars 10 forks source link

Error with examples #22

Closed christoph-maurer closed 2 years ago

christoph-maurer commented 2 years ago

Hi @StephenCzarnecki, when I run python3 example.py, I get the error message

Traceback (most recent call last):
  File "example.py", line 16, in <module>
    glazing_system_single_layer = pywincalc.Glazing_System(solid_layers, gaps, standard, width, height)
AttributeError: module 'pywincalc' has no attribute 'Glazing_System'

If I exchange pywincalc.Glazing_System in line 16 by pywincalc.GlazingSystem, I get the error message

Traceback (most recent call last):
  File "exampleChm01.py", line 16, in <module>
    glazing_system_single_layer = pywincalc.GlazingSystem(solid_layers, gaps, standard, width, height)
TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. pywincalc.GlazingSystem(optical_standard: pywincalc.OpticalStandard, solid_layers: List[pywincalc.ProductDataOpticalAndThermal], gap_layers: List[pywincalc.Gap] = [], width_meters: float = 1.0, height_meters: float = 1.0, tilt_degrees: float = 90, environment: pywincalc.Environments = <pywincalc.Environments object at 0x7f8c6cf230b0>, bsdf_hemisphere: Optional[pywincalc.BSDFHemisphere] = None, spectral_data_wavelength_range_method: pywincalc.SpectalDataWavelengthRangeMethodType = <SpectalDataWavelengthRangeMethodType.FULL: 0>, number_visible_bands: int = 5, number_solar_bands: int = 10)
    2. pywincalc.GlazingSystem(optical_standard: pywincalc.OpticalStandard, solid_layers: List[pywincalc.ProductData], gap_layers: List[pywincalc.Gap] = [], width_meters: float = 1.0, height_meters: float = 1.0, tilt_degrees: float = 90, environment: pywincalc.Environments = <pywincalc.Environments object at 0x7f8c6cf230f0>, bsdf_hemisphere: Optional[pywincalc.BSDFHemisphere] = None, spectral_data_wavelength_range_method: pywincalc.SpectalDataWavelengthRangeMethodType = <SpectalDataWavelengthRangeMethodType.FULL: 0>, number_visible_bands: int = 5, number_solar_bands: int = 10)
    3. pywincalc.GlazingSystem(optical_standard: pywincalc.OpticalStandard, solid_layers: List[Union[pywincalc.ProductData, pywincalc.ProductDataOpticalAndThermal]], gap_layers: List[pywincalc.Gap] = [], width_meters: float = 1.0, height_meters: float = 1.0, tilt_degrees: float = 90, environment: pywincalc.Environments = <pywincalc.Environments object at 0x7f8c6cf23530>, bsdf_hemisphere: Optional[pywincalc.BSDFHemisphere] = None, spectral_data_wavelength_range_method: pywincalc.SpectalDataWavelengthRangeMethodType = <SpectalDataWavelengthRangeMethodType.FULL: 0>, number_visible_bands: int = 5, number_solar_bands: int = 10)

Invoked with: [<pywincalc.ProductData object at 0x7f8c6cf641b0>], [], <pywincalc.OpticalStandard object at 0x7f8c6cf31c30>, 1.0, 1.0

Do you know how I can run an example?

StephenCzarnecki commented 2 years ago

@christoph-maurer We recently promoted quite a few changes to pywincalc. Among those was renaming the default branch to main and restructuring the examples. So there is no long a single example.py file. Instead there are many (20+) example scripts in a /examples directory here https://github.com/LBNL-ETA/pyWinCalc/tree/main/examples.

Can you first verify that you have pulled the latest version of the repo and are on the main branch?

A couple notes:

  1. We added a lot of functionality but that involved making some breaking changes to the interface. On the positive side the documentation has been updated and there is a section that attempts to help migrate any existing code that uses pywincalc here: https://github.com/LBNL-ETA/pyWinCalc#Migrating-from-version-1
  2. There are a lot more examples that should hopefully cover most, if not all, available use cases between them. These include examples that get product data from the IGSDB and are named like igsdb_*.py. To use those examples you will need an API token from IGSDB and will need to place that token in https://github.com/LBNL-ETA/pyWinCalc/blob/main/examples/igsdb_interaction.py where it says "INSERT_YOUR_API_TOKEN_HERE"

Let me know if you still have trouble running any of the examples or have any other questions.

christoph-maurer commented 2 years ago

Sorry, I used an old version. Thank you, @StephenCzarnecki , it works great!