Back-rescale previous (minor) curves from latest
For the "pin to target major/target curve" overlay method, this finally solves the longstanding issue of ensuring that any new minor curve, which requires and increase in the major/target curve y-range, also re-scales all previously scaled minor curves retroactively. Thus we now guarantee that all minor curves are correctly "pinned" to their target/major on their earliest available datum **and** are all kept in view.storage_cli
							parent
							
								
									b118954bf7
								
							
						
					
					
						commit
						d3c85bc925
					
				| 
						 | 
				
			
			@ -651,18 +651,34 @@ def overlay_viewlists(
 | 
			
		|||
 | 
			
		||||
                            # TODO: rescale all already scaled curves to
 | 
			
		||||
                            # new increased range for this side.
 | 
			
		||||
                            # for (
 | 
			
		||||
                            #     view,
 | 
			
		||||
                            #     (yref, ymn, ymx)
 | 
			
		||||
                            # ) in scaled.items():
 | 
			
		||||
                            #     pass
 | 
			
		||||
                            for _view in scaled:
 | 
			
		||||
                                _yref, _ymn, _ymx = scaled[_view]
 | 
			
		||||
                                new_ymn = _yref * (1 + r_dn_minor)
 | 
			
		||||
 | 
			
		||||
                                # TODO: is there a faster way to do this
 | 
			
		||||
                                # by mutating state on some object
 | 
			
		||||
                                # instead?
 | 
			
		||||
                                scaled[_view] = (_yref, new_ymn, _ymx)
 | 
			
		||||
 | 
			
		||||
                        ymx = y_start * (1 + r_major_up_here)
 | 
			
		||||
                        if ymx < y_max:
 | 
			
		||||
                            # set the `scaled: dict` entry to ensure
 | 
			
		||||
                            # that this minor curve will be entirely in
 | 
			
		||||
                            # view.
 | 
			
		||||
                            ymx = y_max
 | 
			
		||||
                            r_up_minor = (ymx - y_start) / y_start
 | 
			
		||||
 | 
			
		||||
                            # adjust the target-major curve's range to
 | 
			
		||||
                            # (log-linearly) include this extra range by
 | 
			
		||||
                            # applying the inverse transform of the
 | 
			
		||||
                            # minor.
 | 
			
		||||
                            mx_ymx = y_ref_major * (1 + r_up_minor)
 | 
			
		||||
 | 
			
		||||
                            for _view in scaled:
 | 
			
		||||
                                _yref, _ymn, _ymx = scaled[_view]
 | 
			
		||||
                                new_ymx = _yref * (1 + r_up_minor)
 | 
			
		||||
                                scaled[_view] = (_yref, _ymn, new_ymx)
 | 
			
		||||
 | 
			
		||||
                        if debug_print:
 | 
			
		||||
                            print(
 | 
			
		||||
                                f'Minor SCALARS {viz.name}:\n'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue